| 1 |
// PR c++/97246 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
template <int... Is, typename T> |
| 5 |
T arg_T(decltype(Is)..., T, ...); |
| 6 |
|
| 7 |
template <int I, int... Is> |
| 8 |
inline constexpr auto get = |
| 9 |
[]<typename... T>(decltype(Is)..., T... v, ...) { |
| 10 |
static_assert( sizeof...(T) == sizeof...(v) ); |
| 11 |
if constexpr ( sizeof...(T) == 1 ) |
| 12 |
return (v,...); |
| 13 |
else { |
| 14 |
using V = decltype(arg_T<__integer_pack(I)...>(v...)); |
| 15 |
return get<I,__integer_pack(I)...>.template operator()<V>(v...); |
| 16 |
} |
| 17 |
}; |
| 18 |
|
| 19 |
static_assert( get<0>('\0', short{1}, 2, long{3}) == 0 ); |