From: Jason Merrill Date: Mon, 12 Mar 2018 12:58:38 +0000 (-0400) Subject: PR c++/84802 - ICE capturing uninstantiated class. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=11b782f7f205c3e88efe89347cd9d80c3525e6ac;p=gcc.git PR c++/84802 - ICE capturing uninstantiated class. * lambda.c (build_capture_proxy): Call complete_type. From-SVN: r258447 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 7ed0d5e992b..703f5970cff 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2018-03-12 Jason Merrill + + PR c++/84802 - ICE capturing uninstantiated class. + * lambda.c (build_capture_proxy): Call complete_type. + 2018-03-09 Jason Merrill PR c++/84770 - ICE with typedef and parameter pack. diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index de064ffc85e..b3c75c84682 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -432,6 +432,8 @@ build_capture_proxy (tree member, tree init) object = convert (type, ptr); } + complete_type (type); + var = build_decl (input_location, VAR_DECL, name, type); SET_DECL_VALUE_EXPR (var, object); DECL_HAS_VALUE_EXPR_P (var) = 1; diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice9.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice9.C new file mode 100644 index 00000000000..a07acfff884 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice9.C @@ -0,0 +1,11 @@ +// PR c++/84802 +// { dg-do compile { target c++14 } } + +template struct A { }; + +void f (A& ar) +{ + [](const auto& x) + { return [x]{}(); } + (ar); +}