diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2017-10-13 17:38:50 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2017-10-13 17:38:50 +0000 |
commit | d7327979fe8bcfdee1a3bfa77068072dc6073991 (patch) | |
tree | 331d0eef5bea748437ed54fa0b192060e77cb079 /gcc | |
parent | e7176f75d6b2dd56059dad5920c770dade79df95 (diff) | |
download | gcc-d7327979fe8bcfdee1a3bfa77068072dc6073991.zip gcc-d7327979fe8bcfdee1a3bfa77068072dc6073991.tar.gz gcc-d7327979fe8bcfdee1a3bfa77068072dc6073991.tar.bz2 |
re PR c++/69078 ([C++14] function local static not initialized when only used in a generic/variadic lambda)
2017-10-13 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/69078
* g++.dg/cpp1y/lambda-generic-69078-1.C: New.
* g++.dg/cpp1y/lambda-generic-69078-2.C: Likewise.
From-SVN: r253736
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/lambda-generic-69078-1.C | 28 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/lambda-generic-69078-2.C | 21 |
3 files changed, 55 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d23143a..589dda5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-10-13 Paolo Carlini <paolo.carlini@oracle.com> + + PR c++/69078 + * g++.dg/cpp1y/lambda-generic-69078-1.C: New. + * g++.dg/cpp1y/lambda-generic-69078-2.C: Likewise. + 2017-10-13 Jakub Jelinek <jakub@redhat.com> PR target/82274 diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-69078-1.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-69078-1.C new file mode 100644 index 0000000..dc045c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-69078-1.C @@ -0,0 +1,28 @@ +// PR c++/69078 +// { dg-do run { target c++14 } } +// { dg-options "-Wall" } + +#include <cassert> + +struct Class { + Class(void (*_param)()) : data(_param) {} + void (*data)(); +}; + +void funUser(void (*test)(int)) { + test(60); +} + +void user(Class& c, int i) { + (void)i; + assert (c.data); +} + +void probe() {} + +int main() { + static Class instance = { probe }; + funUser([](auto... p) { + user(instance, p...); + }); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-69078-2.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-69078-2.C new file mode 100644 index 0000000..318e096 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-69078-2.C @@ -0,0 +1,21 @@ +// PR c++/69078 +// { dg-do run { target c++14 } } + +#include <cassert> + +template<typename F> +void run( F &&f ) { + f(nullptr); +} + +struct V { + int i; +}; + +int main() { + static V const s={2}; + assert (s.i == 2); + run([](auto){ + assert (s.i == 2); + }); +} |