Commit 73f971b7 by John F. Carr Committed by Jakub Jelinek

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
parent 91c82473
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> 2009-01-07 Jakub Jelinek <jakub@redhat.com>
PR c++/38725 PR c++/38725
......
...@@ -14873,6 +14873,7 @@ cp_parser_class_specifier (cp_parser* parser) ...@@ -14873,6 +14873,7 @@ cp_parser_class_specifier (cp_parser* parser)
bool nested_name_specifier_p; bool nested_name_specifier_p;
unsigned saved_num_template_parameter_lists; unsigned saved_num_template_parameter_lists;
bool saved_in_function_body; bool saved_in_function_body;
bool saved_in_unbraced_linkage_specification_p;
tree old_scope = NULL_TREE; tree old_scope = NULL_TREE;
tree scope = NULL_TREE; tree scope = NULL_TREE;
tree bases; tree bases;
...@@ -14924,6 +14925,10 @@ cp_parser_class_specifier (cp_parser* parser) ...@@ -14924,6 +14925,10 @@ cp_parser_class_specifier (cp_parser* parser)
/* We are not in a function body. */ /* We are not in a function body. */
saved_in_function_body = parser->in_function_body; saved_in_function_body = parser->in_function_body;
parser->in_function_body = false; 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. */ /* Start the class. */
if (nested_name_specifier_p) if (nested_name_specifier_p)
...@@ -15036,6 +15041,8 @@ cp_parser_class_specifier (cp_parser* parser) ...@@ -15036,6 +15041,8 @@ cp_parser_class_specifier (cp_parser* parser)
parser->in_function_body = saved_in_function_body; parser->in_function_body = saved_in_function_body;
parser->num_template_parameter_lists parser->num_template_parameter_lists
= saved_num_template_parameter_lists; = saved_num_template_parameter_lists;
parser->in_unbraced_linkage_specification_p
= saved_in_unbraced_linkage_specification_p;
return type; return type;
} }
......
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> 2009-01-09 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38771 PR middle-end/38771
......
// PR c++/37877
// { dg-do compile }
extern "C++" struct S
{
static int x;
} s;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment