aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2005-02-14 17:50:58 +0000
committerNathan Sidwell <nathan@codesourcery.com>2005-02-14 17:50:58 +0000
commit3c62aa7b059269d064c6970cacb2f525e6e49d65 (patch)
treec4a556e8532e7b3fed4462d2fca4e630ff7f9a8c
parentc198f9327f425f7b028864cac166243041d8b21d (diff)
cp:
PR c++/19608 * parser.c (cp_parser_late_parsing_for_member): Use current_function_decl as scope to push to and from. testsuite: PR c++/19608 * g++.dg/parse/local-class1.C: New. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@95036 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/parser.c7
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/g++.dg/parse/local-class1.C14
4 files changed, 25 insertions, 3 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index add1476e0d8..b8f356fd758 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2005-02-14 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/19608
+ * parser.c (cp_parser_late_parsing_for_member): Use
+ current_function_decl as scope to push to and from.
+
PR c++/19884
* pt.c (check_explicit_specialization): Make sure namespace
binding lookup found an overloaded function.
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 453bc693665..f38f6fbc78f 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -15286,9 +15286,10 @@ cp_parser_late_parsing_for_member (cp_parser* parser, tree member_function)
tokens = DECL_PENDING_INLINE_INFO (member_function);
DECL_PENDING_INLINE_INFO (member_function) = NULL;
DECL_PENDING_INLINE_P (member_function) = 0;
- /* If this was an inline function in a local class, enter the scope
- of the containing function. */
- function_scope = decl_function_context (member_function);
+
+ /* If this is a local class, enter the scope of the containing
+ function. */
+ function_scope = current_function_decl;
if (function_scope)
push_function_context_to (function_scope);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 61fef177c41..8384855351f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2005-02-14 Nathan Sidwell <nathan@codesourcery.com>
+ PR c++/19608
+ * g++.dg/parse/local-class1.C: New.
+
PR c++/19895
* g++.dg/parse/ptrmem3.C: New.
diff --git a/gcc/testsuite/g++.dg/parse/local-class1.C b/gcc/testsuite/g++.dg/parse/local-class1.C
new file mode 100644
index 00000000000..4fc7e6ebb13
--- /dev/null
+++ b/gcc/testsuite/g++.dg/parse/local-class1.C
@@ -0,0 +1,14 @@
+ // Copyright (C) 2005 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 14 Feb 2005 <nathan@codesourcery.com>
+
+// Origin: Jorn Wolfgang Rennecke <amylaar@gcc.gnu.org>
+// Bug 19608: ICE on invalid
+
+
+void f ()
+{
+ class c
+ {
+ friend void g () { } // { dg-error "local class definition" "" }
+ };
+}