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.carl...@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.carl...@oracle.com>

        PR c++/84630
        * g++.dg/cpp0x/pr84630.C: New.
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;

Reply via email to