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 struct c { + template __attribute__((noinline([] {}))) int b(); // { dg-error "wrong number of arguments" } +}; +c<> a;