gcc/testsuite/g++.dg/cpp1z/constexpr-96575.C
raw| 1 | // PR c++/96575 |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | |
| 4 | struct S { }; |
| 5 | |
| 6 | constexpr auto g = [] (S s) { |
| 7 | if (__builtin_is_constant_evaluated()) |
| 8 | return s; |
| 9 | }; |
| 10 | |
| 11 | template <class T> |
| 12 | constexpr auto f (T cb) { |
| 13 | return [=] { |
| 14 | auto ret = cb({}); |
| 15 | return ret; |
| 16 | }(); |
| 17 | } |
| 18 | |
| 19 | constexpr auto x = f(g); |