Hi,
avoiding this ICE on invalid seems just matter of setting up the
parser->type_definition_forbidden_message string.
Tested x86_64-linux.
Thanks,
Paolo.
///////////////////////
/cp
2013-05-22 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/57352
* parser.c (cp_parser_conversion_type_id): Set up
parser->type_definition_forbidden_message before calling
cp_parser_type_specifier_seq.
/testsuite
2013-05-22 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/57352
* g++.dg/parse/crash62.C: New.
Index: cp/parser.c
===================================================================
--- cp/parser.c (revision 199204)
+++ cp/parser.c (working copy)
@@ -11715,13 +11715,22 @@ cp_parser_conversion_type_id (cp_parser* parser)
cp_decl_specifier_seq type_specifiers;
cp_declarator *declarator;
tree type_specified;
+ const char *saved_message;
/* Parse the attributes. */
attributes = cp_parser_attributes_opt (parser);
+
+ saved_message = parser->type_definition_forbidden_message;
+ parser->type_definition_forbidden_message
+ = G_("types may not be defined in a conversion-type-id");
+
/* Parse the type-specifiers. */
cp_parser_type_specifier_seq (parser, /*is_declaration=*/false,
/*is_trailing_return=*/false,
&type_specifiers);
+
+ parser->type_definition_forbidden_message = saved_message;
+
/* If that didn't work, stop. */
if (type_specifiers.type == error_mark_node)
return error_mark_node;
Index: testsuite/g++.dg/parse/crash62.C
===================================================================
--- testsuite/g++.dg/parse/crash62.C (revision 0)
+++ testsuite/g++.dg/parse/crash62.C (working copy)
@@ -0,0 +1,6 @@
+// PR c++/57352
+
+struct x
+{
+ operator class {} (); // { dg-error "types|expected" }
+};