aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-08-11 22:13:32 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2004-08-11 22:13:32 +0000
commit2436b51feb8a5cf7ca694eb4bf13bcb1e6899217 (patch)
tree2147acebf7d4edadc9b4e0c586c723982b26e08f /gcc/cp/parser.c
parent5079843a2094412a6b25a23c1eeae4296d0ed15a (diff)
downloadgcc-2436b51feb8a5cf7ca694eb4bf13bcb1e6899217.zip
gcc-2436b51feb8a5cf7ca694eb4bf13bcb1e6899217.tar.gz
gcc-2436b51feb8a5cf7ca694eb4bf13bcb1e6899217.tar.bz2
re PR c++/16964 (ICE in cp_parser_class_specifier due to redefinition)
PR c++/16964 * parser.c (cp_parser_class_specifier): Robustify. PR c++/16904 * pt.c (tsubst_copy_and_build): Complain about invalid qualification. PR c++/16929 * pt.c (tsubst_default_argument): Clear out current_class_ptr and current_class_ref while tsubsting. PR c++/16964 * g++.dg/parse/error16.C: New test. PR c++/16904 * g++.dg/template/error14.C: New test. PR c++/16929 * g++.dg/template/error15.C: New test. From-SVN: r85824
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 2176e05..65872c8 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -12308,6 +12308,7 @@ cp_parser_class_specifier (cp_parser* parser)
bool nested_name_specifier_p;
unsigned saved_num_template_parameter_lists;
bool pop_p = false;
+ tree scope = NULL_TREE;
push_deferring_access_checks (dk_no_deferred);
@@ -12343,7 +12344,10 @@ cp_parser_class_specifier (cp_parser* parser)
/* Start the class. */
if (nested_name_specifier_p)
- pop_p = push_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (type)));
+ {
+ scope = CP_DECL_CONTEXT (TYPE_MAIN_DECL (type));
+ pop_p = push_scope (scope);
+ }
type = begin_class_definition (type);
if (type == error_mark_node)
@@ -12368,7 +12372,7 @@ cp_parser_class_specifier (cp_parser* parser)
if (type != error_mark_node)
type = finish_struct (type, attributes);
if (pop_p)
- pop_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (type)));
+ pop_scope (scope);
/* If this class is not itself within the scope of another class,
then we need to parse the bodies of all of the queued function
definitions. Note that the queued functions defined in a class