gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda4.C
raw| 1 | // PR c++/99201 |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | |
| 4 | template <typename RefF> |
| 5 | auto |
| 6 | make_tester(const RefF& reffun) |
| 7 | { |
| 8 | return [=](auto in) { |
| 9 | auto&& expected = [&](const auto&... vs) { |
| 10 | if constexpr (sizeof(in) > 0) |
| 11 | return [&](int i) { return reffun(vs[i]...); }(0); |
| 12 | else |
| 13 | return [&](int i) { return reffun(vs[i]...); }(0); |
| 14 | }; |
| 15 | }; |
| 16 | } |
| 17 | |
| 18 | int main() |
| 19 | { |
| 20 | make_tester([](int x) { return x; })(0); |
| 21 | return 0; |
| 22 | } |