diff options
author | Jason Merrill <jason@redhat.com> | 2011-04-28 15:02:17 +0000 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2011-04-28 15:02:17 +0000 |
commit | ff60142de63f8bdf53ae89c7b0344ff4fb178714 (patch) | |
tree | 40fe0612fbe8f419d51aea119c449efc2fb890c5 | |
parent | 85ee87be686716029d0320ae90aa2801dc7f85f4 (diff) |
PR c++/48046
* parser.c (cp_parser_diagnose_invalid_type_name): Commit
to tentative parse sooner.
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/gcc-4_5-branch@173116 138bc75d-0d04-0410-961f-82ee72b054a4
-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 c9f9f0d1063..997c7688a44 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-28 Release Manager * GCC 4.5.3 released. diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index d83283b634f..2632d3e422d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -2333,6 +2333,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; @@ -2423,7 +2424,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 4a1a246cce7..62656be1d4f 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-28 Release Manager * GCC 4.5.3 released. diff --git a/gcc/testsuite/g++.dg/parse/ambig6.C b/gcc/testsuite/g++.dg/parse/ambig6.C new file mode 100644 index 00000000000..8f37feaea68 --- /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 "" } +} |