]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/48046 (Expected diagnostic "reference to 'type' is ambiguous" not given...
authorJason Merrill <jason@redhat.com>
Thu, 28 Apr 2011 15:02:17 +0000 (11:02 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 28 Apr 2011 15:02:17 +0000 (11:02 -0400)
PR c++/48046
* parser.c (cp_parser_diagnose_invalid_type_name): Commit
to tentative parse sooner.

From-SVN: r173116

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/ambig6.C [new file with mode: 0644]

index c9f9f0d1063aa0a1fe34f4ce2bf5920acbf590bb..997c7688a444850c717d18c8170282f251b051d5 100644 (file)
@@ -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.
index d83283b634fa003e92d12ab2c03e2a41b7cecfd3..2632d3e422de4ab5827d2c925dc8c6c4c14adcd2 100644 (file)
@@ -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,
index 4a1a246cce7502fb64d86ef5bf1399d76b564317..62656be1d4fd4728b0dee326b936f1c5c1ee59b0 100644 (file)
@@ -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 (file)
index 0000000..8f37fea
--- /dev/null
@@ -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 "" }
+}