aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp1z/constexpr-if-lambda3.C
blob: fa9a4b6d8c0034ac533d2f25126b08ccac43dbbb (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
25
// PR c++/92583
// { dg-do compile { target c++17 } }

template <int> struct a {
  constexpr operator int() { return 42; }
};
template <typename> using b = int;
template <typename d, d> struct e {};
template <typename d, d g> using h = e<d, __integer_pack(g)...>;
template <typename j, typename k, k... index> void apply(j f, e<k, index...>) {
  (f(a<index>{}), ...);
}
template <auto l, typename j> void m(j f) {
  using k = b<decltype(l)>;
  using n = h<k, l>;
  apply(f, n{});
}
template <int, int c> void o() {
  auto p = [](auto i) {
    if constexpr (a<i>{}) ;
    if constexpr (typename a<i>::t{});	// { dg-error "" }
  };
  m<c>(p);
}
auto q() { o<0, 1>; }