re PR c++/37877 (Invalid "invalid use of static" error)

PR c++/37877
	* parser.c (cp_parser_class_specifier): Clear
	parser->in_unbraced_linkage_specification_p while parsing class
	specifiers.

	* g++.dg/parse/linkage3.C: New test.

From-SVN: r143206
This commit is contained in:
John F. Carr 2009-01-09 14:45:44 +00:00 committed by Jakub Jelinek
parent 91c82473ac
commit 73f971b716
4 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2009-01-09 John F. Carr <jfc@mit.edu>
PR c++/37877
* parser.c (cp_parser_class_specifier): Clear
parser->in_unbraced_linkage_specification_p while parsing class
specifiers.
2009-01-07 Jakub Jelinek <jakub@redhat.com>
PR c++/38725

View File

@ -14873,6 +14873,7 @@ cp_parser_class_specifier (cp_parser* parser)
bool nested_name_specifier_p;
unsigned saved_num_template_parameter_lists;
bool saved_in_function_body;
bool saved_in_unbraced_linkage_specification_p;
tree old_scope = NULL_TREE;
tree scope = NULL_TREE;
tree bases;
@ -14924,6 +14925,10 @@ cp_parser_class_specifier (cp_parser* parser)
/* We are not in a function body. */
saved_in_function_body = parser->in_function_body;
parser->in_function_body = false;
/* We are not immediately inside an extern "lang" block. */
saved_in_unbraced_linkage_specification_p
= parser->in_unbraced_linkage_specification_p;
parser->in_unbraced_linkage_specification_p = false;
/* Start the class. */
if (nested_name_specifier_p)
@ -15036,6 +15041,8 @@ cp_parser_class_specifier (cp_parser* parser)
parser->in_function_body = saved_in_function_body;
parser->num_template_parameter_lists
= saved_num_template_parameter_lists;
parser->in_unbraced_linkage_specification_p
= saved_in_unbraced_linkage_specification_p;
return type;
}

View File

@ -1,3 +1,8 @@
2009-01-09 John F. Carr <jfc@mit.edu>
PR c++/37877
* g++.dg/parse/linkage3.C: New test.
2009-01-09 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38771

View File

@ -0,0 +1,7 @@
// PR c++/37877
// { dg-do compile }
extern "C++" struct S
{
static int x;
} s;