* parser.c (cp_parser_type_specifier): Catch template declaration
of enum.
* g++.dg/parse/enum2.C: New test.
* g++.old-deja/g++.pt/enum5.C: Adjust error location.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@91630
138bc75d-0d04-0410-961f-
82ee72b054a4
+2004-12-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/18123
+ * parser.c (cp_parser_type_specifier): Catch template declaration
+ of enum.
+
2004-12-01 Matt Austern <austern@apple.com>
* name-lookup.c (namespace_binding): Omit alias check for global namespace.
&& cp_lexer_peek_nth_token (parser->lexer, 3)->type
== CPP_OPEN_BRACE))
{
- type_spec = cp_parser_enum_specifier (parser);
+ if (parser->num_template_parameter_lists)
+ {
+ error ("template declaration of %qs", "enum");
+ cp_parser_skip_to_end_of_block_or_statement (parser);
+ type_spec = error_mark_node;
+ }
+ else
+ type_spec = cp_parser_enum_specifier (parser);
+
if (declares_class_or_enum)
*declares_class_or_enum = 2;
if (decl_specs)
+2004-12-02 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
+
+ PR c++/18123
+ * g++.dg/parse/enum2.C: New test.
+ * g++.old-deja/g++.pt/enum5.C: Adjust error location.
+
2004-12-02 Nick Clifton <nickc@redhat.com>
* gcc.target/xstormy16: New test directory.
--- /dev/null
+// { dg-do compile }
+
+// Origin: Volker Reichelt <reichelt@gcc.gnu.org>
+
+// PR c++/18123: ICE pushing tag from invalid template.
+
+template<int> enum E { e }; // { dg-error "template declaration" }
// { dg-do assemble }
-template <>
-enum E {e}; // { dg-error "" } template declaration of enum
+template <> // { dg-error "" } template declaration of enum
+enum E {e};