aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/parser.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2006-06-16 18:45:50 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2006-06-16 18:45:50 +0000
commit75a829785fbfeedcb435e7aa3b43d96ad44926b0 (patch)
treea5987a2bada0d0170ebd18a2d701ef8877ae09f6 /gcc/cp/parser.c
parent04879af33dfc9bee6ef86b01f83e8554f23690a0 (diff)
downloadgcc-75a829785fbfeedcb435e7aa3b43d96ad44926b0.zip
gcc-75a829785fbfeedcb435e7aa3b43d96ad44926b0.tar.gz
gcc-75a829785fbfeedcb435e7aa3b43d96ad44926b0.tar.bz2
re PR c++/27884 (bogus error: invalid use of 'register' in linkage specification)
PR c++/27884 * decl.c (have_extern_spec): Remove. (start_decl): Do not check have_extern_spec. (start_function): Likewise. * cp-tree.h (have_extern_spec): Remove. * parser.c (cp_parser_linkage_specification): Don't set have_extern_spec. (cp_parser_init_declarator): Likewise. (cp_parser_parameter_declaration): Do not treat parameters as within the scope of an unbraced linkage specification. PR c++/27884 * g++.dg/parse/linkage2.C: New test From-SVN: r114727
Diffstat (limited to 'gcc/cp/parser.c')
-rw-r--r--gcc/cp/parser.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index df175fa..964ab0e 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -7732,9 +7732,7 @@ cp_parser_linkage_specification (cp_parser* parser)
saved_in_unbraced_linkage_specification_p
= parser->in_unbraced_linkage_specification_p;
parser->in_unbraced_linkage_specification_p = true;
- have_extern_spec = true;
cp_parser_declaration (parser);
- have_extern_spec = false;
parser->in_unbraced_linkage_specification_p
= saved_in_unbraced_linkage_specification_p;
}
@@ -11063,10 +11061,7 @@ cp_parser_init_declarator (cp_parser* parser,
if (!member_p)
{
if (parser->in_unbraced_linkage_specification_p)
- {
- decl_specifiers->storage_class = sc_extern;
- have_extern_spec = false;
- }
+ decl_specifiers->storage_class = sc_extern;
decl = start_decl (declarator, decl_specifiers,
is_initialized, attributes, prefix_attributes,
&pushed_scope);
@@ -12119,9 +12114,16 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error)
{
cp_parameter_declarator *parameters = NULL;
cp_parameter_declarator **tail = &parameters;
+ bool saved_in_unbraced_linkage_specification_p;
/* Assume all will go well. */
*is_error = false;
+ /* The special considerations that apply to a function within an
+ unbraced linkage specifications do not apply to the parameters
+ to the function. */
+ saved_in_unbraced_linkage_specification_p
+ = parser->in_unbraced_linkage_specification_p;
+ parser->in_unbraced_linkage_specification_p = false;
/* Look for more parameters. */
while (true)
@@ -12200,6 +12202,9 @@ cp_parser_parameter_declaration_list (cp_parser* parser, bool *is_error)
}
}
+ parser->in_unbraced_linkage_specification_p
+ = saved_in_unbraced_linkage_specification_p;
+
return parameters;
}