diff mbox series

[C++] PR 84630 ("[6/7/8 Regression] ICE: TYPE_NAME() used on error_mark_node in tsubst_lambda_expr, at cp/pt.c:17141")

Message ID d9fff5b3-59b9-d573-07a6-4935ee42f9e3@oracle.com
State New
Headers show
Series [C++] PR 84630 ("[6/7/8 Regression] ICE: TYPE_NAME() used on error_mark_node in tsubst_lambda_expr, at cp/pt.c:17141") | expand

Commit Message

Paolo Carlini April 17, 2018, 7:58 p.m. UTC
Hi,

this one seems easy: just check the return value of begin_lambda_type 
for error_mark_node - exactly like we do in the parser - and avoid 
ICEing immediately after for the submitted snippet. Tested x86_64-linux.

Thanks, Paolo.

//////////////////////
/cp
2018-04-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84630
	* pt.c (tsubst_lambda_expr): Check begin_lambda_type return value
	for error_mark_node.

/testsuite
2018-04-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/84630
	* g++.dg/cpp0x/pr84630.C: New.

Comments

Jason Merrill April 18, 2018, 1:24 a.m. UTC | #1
Ok.

On Tue, Apr 17, 2018, 1:59 PM Paolo Carlini <paolo.carlini@oracle.com>
wrote:

> Hi,
>
> this one seems easy: just check the return value of begin_lambda_type
> for error_mark_node - exactly like we do in the parser - and avoid
> ICEing immediately after for the submitted snippet. Tested x86_64-linux.
>
> Thanks, Paolo.
>
> //////////////////////
>
>
diff mbox series

Patch

Index: cp/pt.c
===================================================================
--- cp/pt.c	(revision 259444)
+++ cp/pt.c	(working copy)
@@ -17281,6 +17281,8 @@  tsubst_lambda_expr (tree t, tree args, tsubst_flag
     }
 
   tree type = begin_lambda_type (r);
+  if (type == error_mark_node)
+    return error_mark_node;
 
   /* Do this again now that LAMBDA_EXPR_EXTRA_SCOPE is set.  */
   determine_visibility (TYPE_NAME (type));
Index: testsuite/g++.dg/cpp0x/pr84630.C
===================================================================
--- testsuite/g++.dg/cpp0x/pr84630.C	(nonexistent)
+++ testsuite/g++.dg/cpp0x/pr84630.C	(working copy)
@@ -0,0 +1,7 @@ 
+// PR c++/84630
+// { dg-do compile { target c++11 } }
+
+template <typename...> struct c {
+  template <int> __attribute__((noinline([] {}))) int b();  // { dg-error "wrong number of arguments" }
+};
+c<> a;