diff mbox

[C++] PR 58563

Message ID 5249DDDB.1080604@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 30, 2013, 8:23 p.m. UTC
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.carlini@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.carlini@oracle.com>

	PR c++/58563
	* g++.dg/cpp0x/pr58563.C: New.

Comments

Jason Merrill Oct. 1, 2013, 3:37 p.m. UTC | #1
OK.

Jason
diff mbox

Patch

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" }
+}