re PR c++/79005 (Use of a captured variable within nested generic lambdas provokes...
authorPaolo Carlini <paolo.carlini@oracle.com>
Mon, 2 Oct 2017 21:44:55 +0000 (21:44 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Mon, 2 Oct 2017 21:44:55 +0000 (21:44 +0000)
2017-10-02  Paolo Carlini  <paolo.carlini@oracle.com>

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

From-SVN: r253368

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

index 8c5139433922853a037e8ff9d806167ae89713ee..e678265bdd013f218fc9f67edc82751f8ce6d082 100644 (file)
@@ -1,3 +1,8 @@
+2017-10-02  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/79005
+       * g++.dg/cpp1y/lambda-generic-79005.C: New.
+
 2017-10-02  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/82312
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-79005.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-79005.C
new file mode 100644 (file)
index 0000000..79b89ca
--- /dev/null
@@ -0,0 +1,21 @@
+// PR c++/79005
+// { dg-do compile { target c++14 } }
+
+int main()
+{
+  auto glambda = [] (auto a)
+      {
+        const int c = a;
+        auto cglambda = [&] ( auto b )
+            { 
+              double result;
+              result = b * a;
+              result = b * c;
+              return result;
+            };
+        cglambda ( 1 );
+        a = c;
+      };
+
+  glambda( 1 );
+}