PR c++/67244
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Aug 2015 18:42:09 +0000 (18:42 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 17 Aug 2015 18:42:09 +0000 (18:42 +0000)
* pt.c (tsubst_copy_and_build): Call insert_pending_capture_proxies.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@226950 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C [new file with mode: 0644]

index 078ee74..ca00d03 100644 (file)
@@ -1,5 +1,8 @@
 2015-08-17  Jason Merrill  <jason@redhat.com>
 
+       PR c++/67244
+       * pt.c (tsubst_copy_and_build): Call insert_pending_capture_proxies.
+
        PR c++/67104
        * constexpr.c (array_index_cmp, find_array_ctor_elt): New.
        (cxx_eval_array_reference, cxx_eval_store_expression): Use them.
index ecd86e4..b84bda4 100644 (file)
@@ -16344,6 +16344,8 @@ tsubst_copy_and_build (tree t,
 
        LAMBDA_EXPR_THIS_CAPTURE (r) = NULL_TREE;
 
+       insert_pending_capture_proxies ();
+
        RETURN (build_lambda_object (r));
       }
 
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested5.C
new file mode 100644 (file)
index 0000000..3ebdf3b
--- /dev/null
@@ -0,0 +1,29 @@
+// PR c++/67244
+// { dg-do compile { target c++11 } }
+
+class A {
+public:
+  int operator*();
+};
+template <typename T, typename Predicate>
+void searchGen(int, int, T, Predicate p4) {
+  p4(0);
+}
+template <typename...> struct B;
+template <typename MetaFunction, typename Type, typename... Types>
+struct B<MetaFunction, Type, Types...> {
+  static void exec() { MetaFunction::template exec<Type>; }
+};
+template <typename MetaFunction, typename... Types> void forEachType() {
+  B<MetaFunction, Types...>::exec;
+}
+namespace {
+struct C {
+  template <typename T> void exec() {
+    A __trans_tmp_1;
+    const auto target = *__trans_tmp_1;
+    searchGen(0, 0, 0, [=](T) { [=] { target; }; });
+  }
+};
+}
+void ____C_A_T_C_H____T_E_S_T____75() { forEachType<C, int>; }