re PR c++/64834 (Captured variable not available in unevaluated context in a lambda...
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 5 Mar 2015 08:48:22 +0000 (08:48 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 5 Mar 2015 08:48:22 +0000 (08:48 +0000)
2015-03-05  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/64834
* g++.dg/cpp1y/lambda-generic-uneval1.C: New.

From-SVN: r221205

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

index a16501a222d002e2306dd1674295e6834efefd8a..937afa58a366f5f6b1c2dbd85e6ab840f16654fb 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-05  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/64834
+       * g++.dg/cpp1y/lambda-generic-uneval1.C: New.
+
 2015-03-04  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gnat.dg/entry_queues3.adb: New test.
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-uneval1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-uneval1.C
new file mode 100644 (file)
index 0000000..113eacf
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/64834
+// { dg-do compile { target c++14 } }
+
+template <typename F>
+void e(F f)
+{
+  f(1);
+}
+
+template <int I>
+void bar() {
+    int x;
+    e([&] (const int& y) { (void)sizeof(x); });
+    e([&] (const auto& y) { (void)sizeof(x); });
+}
+
+void baz() { bar<1>(); }