aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
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