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 7ed0d5e..703f597 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 de064ff..b3c75c8 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);
+}