From: Paolo Carlini Date: Wed, 4 Oct 2017 08:34:40 +0000 (+0000) Subject: re PR c++/78816 ([c++14] Static auto variable usage in generic/variadic lambda fails... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8bca3f592cd3eca48afd88939160b2ebae8e47e5;p=gcc.git re PR c++/78816 ([c++14] Static auto variable usage in generic/variadic lambda fails to compile) 2017-10-04 Paolo Carlini PR c++/78816 * g++.dg/cpp1y/lambda-generic-variadic6.C: New. From-SVN: r253397 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 816646517ac..192fac794c8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-10-04 Paolo Carlini + + PR c++/78816 + * g++.dg/cpp1y/lambda-generic-variadic6.C: New. + 2017-10-04 Jakub Jelinek 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 00000000000..d6672a4f086 --- /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 +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){})); +}