aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda7.C
blob: 8304c8f22e37b2f66ee56e68f8a5cb12c5eff469 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// PR c++/116756
// { dg-do compile { target c++17 } }

template<int N> struct cst { static constexpr int value = N; };

struct Store {
  void openDF() {
    auto lambda = [this](auto& self, auto I) {
      if constexpr (I.value == 0) {
        auto next = [&self] { self(self, cst<1>{}); };
        openSeries(next);
      } else {
        openSeries(0);
      }
    };
    lambda(lambda, cst<0>{});
  }
  template<class T> void openSeries(T) { }
};

int main() {
  Store store;
  store.openDF();
}