aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Carlini <paolo.carlini@oracle.com>2017-10-04 08:34:40 +0000
committerPaolo Carlini <paolo@gcc.gnu.org>2017-10-04 08:34:40 +0000
commit8bca3f592cd3eca48afd88939160b2ebae8e47e5 (patch)
tree390abd3fee9d18a8cb559bea651837ac08d51236
parent8a8e744eb2f8974501e73e92d5a698c48adf7d2a (diff)
downloadgcc-8bca3f592cd3eca48afd88939160b2ebae8e47e5.zip
gcc-8bca3f592cd3eca48afd88939160b2ebae8e47e5.tar.gz
gcc-8bca3f592cd3eca48afd88939160b2ebae8e47e5.tar.bz2
re PR c++/78816 ([c++14] Static auto variable usage in generic/variadic lambda fails to compile)
2017-10-04 Paolo Carlini <paolo.carlini@oracle.com> PR c++/78816 * g++.dg/cpp1y/lambda-generic-variadic6.C: New. From-SVN: r253397
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic6.C19
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8166465..192fac7 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2017-10-04 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/78816
+ * g++.dg/cpp1y/lambda-generic-variadic6.C: New.
+
2017-10-04 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/82374
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic6.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic6.C
new file mode 100644
index 0000000..d6672a4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-variadic6.C
@@ -0,0 +1,19 @@
+// PR c++/78816
+// { dg-do compile { target c++14 } }
+
+void f(void (*f1)(int)) {
+ f1(42);
+}
+
+template <typename Lambda>
+static auto callback(Lambda &&l)
+{
+ static auto* p = &l;
+ p = &l;
+ return [](auto... x){ return (*p)(x...); };
+}
+
+int main() {
+ int x = 5;
+ f(callback([=](int y){}));
+}