re PR c++/89522 (ICE: trying to capture 'f' in instantiation of generic lambda)
authorPaolo Carlini <paolo.carlini@oracle.com>
Thu, 28 Feb 2019 10:27:03 +0000 (10:27 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 28 Feb 2019 10:27:03 +0000 (10:27 +0000)
2019-02-28  Paolo Carlini  <paolo.carlini@oracle.com>

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

From-SVN: r269275

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

index c711829816ec2fb9f63036f6443f961956d06b65..8c80d5e88d1a426306038dfb6c648095aad63214 100644 (file)
@@ -1,3 +1,8 @@
+2019-02-28  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/89522
+       * g++.dg/cpp1y/lambda-generic-ice10.C: New.
+
 2019-02-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR c/89525
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice10.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice10.C
new file mode 100644 (file)
index 0000000..c46acec
--- /dev/null
@@ -0,0 +1,18 @@
+// PR c++/89522
+// { dg-do compile { target c++14 } }
+
+template <typename F>
+void foo (F f)
+{
+  f (1);
+}
+template <typename T>
+void bar (T)
+{
+  auto f = [&](auto i) { if (f); };  // { dg-error "use of .f. before deduction of .auto." }
+  foo (f);
+}
+int main ()
+{
+  bar (0);
+}