Hi,

this ICE seems easy to avoid: just check the return value of make_typename_type for error_mark_node, like we normally do everywhere else in the parser.

Tested x86_64-linux.

Thanks,
Paolo.

///////////////////////////


/cp
2013-09-30  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58563
        * parser.c (cp_parser_lookup_name): Check make_typename_type return
        value for error_mark_node.

/testsuite
2013-09-30  Paolo Carlini  <paolo.carl...@oracle.com>

        PR c++/58563
        * g++.dg/cpp0x/pr58563.C: New.
Index: cp/parser.c
===================================================================
--- cp/parser.c (revision 203037)
+++ cp/parser.c (working copy)
@@ -21756,7 +21756,8 @@ cp_parser_lookup_name (cp_parser *parser, tree nam
                 is dependent.  */
              type = make_typename_type (parser->scope, name, tag_type,
                                         /*complain=*/tf_error);
-             decl = TYPE_NAME (type);
+             if (type != error_mark_node)
+               decl = TYPE_NAME (type);
            }
          else if (is_template
                   && (cp_parser_next_token_ends_template_argument_p (parser)
Index: testsuite/g++.dg/cpp0x/pr58563.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr58563.C    (revision 0)
+++ testsuite/g++.dg/cpp0x/pr58563.C    (working copy)
@@ -0,0 +1,8 @@
+// PR c++/58563
+// { dg-do compile { target c++11 } }
+
+template<int> void foo()
+{
+  enum E {};
+  E().E::~T(); // { dg-error "not a class" }
+}

Reply via email to