| 1 |
// Pack expansion testcases from P2082R1 |
| 2 |
// { dg-do compile { target c++20 } } |
| 3 |
|
| 4 |
template<typename U, typename... T> |
| 5 |
struct C2 : T... { |
| 6 |
U a; |
| 7 |
static constexpr int len = sizeof...(T); |
| 8 |
}; |
| 9 |
C2 c2 = { |
| 10 |
[]{ return 1; }, |
| 11 |
}; |
| 12 |
static_assert (c2.len == 0); |
| 13 |
|
| 14 |
template <typename... T> |
| 15 |
struct Types {}; |
| 16 |
template <typename... T> |
| 17 |
struct F : Types<T...>, T... {}; |
| 18 |
struct X {}; |
| 19 |
struct Y {}; |
| 20 |
struct Z {}; |
| 21 |
struct W { operator Y(); }; |
| 22 |
F f1 = {Types<X, Y, Z>{}, {}, {}}; // OK, F<X, Y, Z> deduced |
| 23 |
F f2 = {Types<X, Y, Z>{}, X{}, Y{}}; // OK, F<X, Y, Z> deduced |
| 24 |
F f3 = {Types<X, Y, Z>{}, X{}, W{}}; // { dg-error "" } conflicting types deduced; operator Y not considered |