re PR c++/19253 (bad error message / ICE for invalid template parameter)
authorMark Mitchell <mark@codesourcery.com>
Sat, 29 Jan 2005 02:07:18 +0000 (02:07 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sat, 29 Jan 2005 02:07:18 +0000 (02:07 +0000)
PR c++/19253
* parser.c (cp_parser_diagnose_invalid_type_name): Commit to
tentative parses.

PR c++/19253
* g++.dg/template/crash33.C: New test.

From-SVN: r94403

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

index 077113c61dead142ed785221fe988249ae895d2f..dbb8551f72c6a0a3fab6d4ebe51c491331cf58f1 100644 (file)
@@ -1,5 +1,9 @@
 2005-01-28  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/19253
+       * parser.c (cp_parser_diagnose_invalid_type_name): Commit to
+       tentative parses.
+
        PR c++/19667
        * pt.c (redeclare_class_template): Robustify.
 
index 9b43eff33580fe22150ee962560c81dbc9516479..1599d9c0637c4158154d42d9fce4e85333d9d7ff 100644 (file)
@@ -1961,7 +1961,10 @@ cp_parser_non_integral_constant_expression (cp_parser  *parser,
 }
 
 /* Emit a diagnostic for an invalid type name.  SCOPE is the
-   qualifying scope (or NULL, if none) for ID.  */
+   qualifying scope (or NULL, if none) for ID.  This function commits
+   to the current active tentative parse, if any.  (Otherwise, the
+   problematic construct might be encountered again later, resulting
+   in duplicate error messages.)  */
 
 static void
 cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
@@ -2033,6 +2036,7 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
       else
        gcc_unreachable ();
     }
+  cp_parser_commit_to_tentative_parse (parser);
 }
 
 /* Check for a common situation where a type-name should be present,
index 06c06d3a3d6196b1b112f64f4dcb706cf771ec3b..dd24748487c7142d4f9386f027c23881974479cf 100644 (file)
@@ -1,5 +1,8 @@
 2005-01-28  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/19253
+       * g++.dg/template/crash33.C: New test.
+
        PR c++/19667
        * g++.dg/template/crash32.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/template/crash33.C b/gcc/testsuite/g++.dg/template/crash33.C
new file mode 100644 (file)
index 0000000..059e328
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/19253
+
+namespace N {}
+
+template<typename> struct A
+{
+  A<typename N::X<int> > a; // { dg-error "" }
+};