diff options
author | John F. Carr <jfc@mit.edu> | 2009-01-09 14:45:44 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2009-01-09 15:45:44 +0100 |
commit | 73f971b716256c5c37753748fa7c8ade3c49da21 (patch) | |
tree | 9052a96b1013724ee11a155a55db3c1ddb3e2f18 | |
parent | 91c82473ac6c389e29e73bdae4e4375176ac0bf3 (diff) | |
download | gcc-73f971b716256c5c37753748fa7c8ade3c49da21.zip gcc-73f971b716256c5c37753748fa7c8ade3c49da21.tar.gz gcc-73f971b716256c5c37753748fa7c8ade3c49da21.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/parser.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/linkage3.C | 7 |
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index a0be740..6d09faf 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 545d3dd..f497d66 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 199cd6e..a86c18c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 diff --git a/gcc/testsuite/g++.dg/parse/linkage3.C b/gcc/testsuite/g++.dg/parse/linkage3.C new file mode 100644 index 0000000..0d952d1 --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/linkage3.C @@ -0,0 +1,7 @@ +// PR c++/37877 +// { dg-do compile } + +extern "C++" struct S +{ + static int x; +} s; |