Patchwork [C++] PR 58563

login
register
mail settings
Submitter Paolo Carlini
Date Sept. 30, 2013, 8:23 p.m.
Message ID <5249DDDB.1080604@oracle.com>
Download mbox | patch
Permalink /patch/279254/
State New
Headers show

Comments

Paolo Carlini - Sept. 30, 2013, 8:23 p.m.
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.
Jason Merrill - Oct. 1, 2013, 3:37 p.m.
OK.

Jason

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