| 1 |
// PR c++/92583 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
|
| 4 |
template <int> struct a { |
| 5 |
constexpr operator int() { return 42; } |
| 6 |
}; |
| 7 |
template <typename> using b = int; |
| 8 |
template <typename d, d> struct e {}; |
| 9 |
template <typename d, d g> using h = e<d, __integer_pack(g)...>; |
| 10 |
template <typename j, typename k, k... index> void apply(j f, e<k, index...>) { |
| 11 |
(f(a<index>{}), ...); |
| 12 |
} |
| 13 |
template <auto l, typename j> void m(j f) { |
| 14 |
using k = b<decltype(l)>; |
| 15 |
using n = h<k, l>; |
| 16 |
apply(f, n{}); |
| 17 |
} |
| 18 |
template <int, int c> void o() { |
| 19 |
auto p = [](auto i) { |
| 20 |
if constexpr (a<i>{}) ; |
| 21 |
if constexpr (typename a<i>::t{}); // { dg-error "" } |
| 22 |
}; |
| 23 |
m<c>(p); |
| 24 |
} |
| 25 |
auto q() { o<0, 1>; } |