PR c++/84802 - ICE capturing uninstantiated class.
authorJason Merrill <jason@redhat.com>
Mon, 12 Mar 2018 12:58:38 +0000 (08:58 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 12 Mar 2018 12:58:38 +0000 (08:58 -0400)
* lambda.c (build_capture_proxy): Call complete_type.

From-SVN: r258447

gcc/cp/ChangeLog
gcc/cp/lambda.c
gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice9.C [new file with mode: 0644]

index 7ed0d5e992b59ec6564edde4d9ad64ca27b51f3c..703f5970cff6a5380563ddd6d0419171f6b13cbb 100644 (file)
@@ -1,3 +1,8 @@
+2018-03-12  Jason Merrill  <jason@redhat.com>
+
+       PR c++/84802 - ICE capturing uninstantiated class.
+       * lambda.c (build_capture_proxy): Call complete_type.
+
 2018-03-09  Jason Merrill  <jason@redhat.com>
 
        PR c++/84770 - ICE with typedef and parameter pack.
index de064ffc85e48ce7a013cfe7bacde16749a4f422..b3c75c84682086cb618ae056b8a804da064c7b44 100644 (file)
@@ -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 (file)
index 0000000..a07acff
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/84802
+// { dg-do compile { target c++14 } }
+
+template <class T> struct A { };
+
+void f (A<int>& ar)
+{
+  [](const auto& x)
+    { return [x]{}(); }
+  (ar);
+}