diff options
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r-- | gcc/cp/parser.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 56605de..10238c4 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -12342,12 +12342,22 @@ cp_parser_class_specifier (cp_parser* parser) if (nested_name_specifier_p) pop_p = push_scope (CP_DECL_CONTEXT (TYPE_MAIN_DECL (type))); type = begin_class_definition (type); + + if (processing_template_decl) + /* There are no access checks when parsing a template, as we do no + know if a specialization will be a friend. */ + push_deferring_access_checks (dk_no_check); + if (type == error_mark_node) /* If the type is erroneous, skip the entire body of the class. */ cp_parser_skip_to_closing_brace (parser); else /* Parse the member-specification. */ cp_parser_member_specification_opt (parser); + + if (processing_template_decl) + pop_deferring_access_checks (); + /* Look for the trailing `}'. */ cp_parser_require (parser, CPP_CLOSE_BRACE, "`}'"); /* We get better error messages by noticing a common problem: a |