diff options
author | Jason Merrill <jason@redhat.com> | 2011-04-27 11:56:46 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-04-27 11:56:46 -0400 |
commit | 9e0541d9c0b2842b738a99a70673be0752ee591d (patch) | |
tree | e294f7cba70150155b8106291cc721b1c66c5ce7 /gcc | |
parent | 7036ee2437cd84d585a4149020a2d1fcc89d88fd (diff) | |
download | gcc-9e0541d9c0b2842b738a99a70673be0752ee591d.zip gcc-9e0541d9c0b2842b738a99a70673be0752ee591d.tar.gz gcc-9e0541d9c0b2842b738a99a70673be0752ee591d.tar.bz2 |
re PR c++/48046 (Expected diagnostic "reference to 'type' is ambiguous" not given for function-local static declaration)
PR c++/48046
* parser.c (cp_parser_diagnose_invalid_type_name): Commit
to tentative parse sooner.
From-SVN: r173036
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/parse/ambig6.C | 12 |
4 files changed, 23 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c6e83de..6873f64 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-04-27 Jason Merrill <jason@redhat.com> + + PR c++/48046 + * parser.c (cp_parser_diagnose_invalid_type_name): Commit + to tentative parse sooner. + 2011-04-26 Jason Merrill <jason@redhat.com> PR c++/42687 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 68ce052..89100aa 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -2440,6 +2440,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, location_t location) { tree decl, old_scope; + cp_parser_commit_to_tentative_parse (parser); /* Try to lookup the identifier. */ old_scope = parser->scope; parser->scope = scope; @@ -2533,7 +2534,6 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, else gcc_unreachable (); } - cp_parser_commit_to_tentative_parse (parser); } /* Check for a common situation where a type-name should be present, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 25cf23d..328d8dc 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-04-27 Jason Merrill <jason@redhat.com> + + * g++.dg/parse/ambig6.C: New. + 2011-04-27 Nick Clifton <nickc@redhat.com> * gcc.dg/20020312-2.c: Add definition for RX. diff --git a/gcc/testsuite/g++.dg/parse/ambig6.C b/gcc/testsuite/g++.dg/parse/ambig6.C new file mode 100644 index 0000000..8f37fea --- /dev/null +++ b/gcc/testsuite/g++.dg/parse/ambig6.C @@ -0,0 +1,12 @@ +// PR c++/48046 + +namespace N1 { typedef int T; } // { dg-error "" } +namespace N2 { typedef float T; } // { dg-error "" } + +int main() +{ + using namespace N1; + using namespace N2; + + static T t; // { dg-error "" } +} |