PR c++/78840 - ICE with const and nested generic lambda
authorJason Merrill <jason@gcc.gnu.org>
Tue, 29 Aug 2017 20:21:23 +0000 (16:21 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 29 Aug 2017 20:21:23 +0000 (16:21 -0400)
* g++.dg/cpp1y/lambda-generic-const5.C: New.

From-SVN: r251431

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

diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const5.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-const5.C
new file mode 100644 (file)
index 0000000..65e52cc
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/78840
+// { dg-do compile { target c++14 } }
+
+int global;
+
+void Bar (int);
+
+template<int I> void Foo () {
+  const int cst = global;
+  auto lam0 = [&]() -> void {
+    auto lam1 = [&]() -> void { cst; };
+    
+    Bar (cst);
+  };
+}
+
+template void Foo <0> ();