gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda7.C
raw| 1 | // PR c++/116756 |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | |
| 4 | template<int N> struct cst { static constexpr int value = N; }; |
| 5 | |
| 6 | struct Store { |
| 7 | void openDF() { |
| 8 | auto lambda = [this](auto& self, auto I) { |
| 9 | if constexpr (I.value == 0) { |
| 10 | auto next = [&self] { self(self, cst<1>{}); }; |
| 11 | openSeries(next); |
| 12 | } else { |
| 13 | openSeries(0); |
| 14 | } |
| 15 | }; |
| 16 | lambda(lambda, cst<0>{}); |
| 17 | } |
| 18 | template<class T> void openSeries(T) { } |
| 19 | }; |
| 20 | |
| 21 | int main() { |
| 22 | Store store; |
| 23 | store.openDF(); |
| 24 | } |