+2007-03-22 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/30863
+ * parser.c (cp_parser_parse_and_diagnose_invalid_type_name): Do
+ not consume tokens when failing.
+
2007-03-22 Jim Wilson <wilson@specifix.com>
Mark Mitchell <mark@codesourcery.com>
the scope is dependent, we cannot do much. */
if (!cp_lexer_next_token_is (parser->lexer, CPP_NAME)
|| (parser->scope && TYPE_P (parser->scope)
- && dependent_type_p (parser->scope)))
+ && dependent_type_p (parser->scope))
+ || TREE_CODE (id) == TYPE_DECL)
{
cp_parser_abort_tentative_parse (parser);
return false;
}
- if (!cp_parser_parse_definitely (parser) || TREE_CODE (id) == TYPE_DECL)
+ if (!cp_parser_parse_definitely (parser))
return false;
/* Emit a diagnostic for the invalid type. */
+2007-03-22 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/30863
+ * g++.dg/template/error24.C: New test.
+ * g++.dg/parse/tmpl-outside1.C: Tweak error markers.
+
2007-03-22 Mark Mitchell <mark@codesourcery.com>
PR c++/31273
template <int i> struct Y {};
};
-typedef X::template Y<0> y; // { dg-error "template" }
-// { dg-bogus "with no type" "" { xfail *-*-* } 10 }
+typedef X::template Y<0> y; // { dg-error "template|invalid" }
--- /dev/null
+// PR c++/30863
+
+template <typename T>
+struct s {};
+
+void f() {
+ unsigned s<int> x; // { dg-error "invalid" }
+}