| 1 | // Named type parameter pack. |
| 2 | template <typename... Is> |
| 3 | struct TypePack { int a; }; |
| 4 | TypePack<> emptyTypePack; |
| 5 | TypePack<int> oneElemTypePack; |
| 6 | TypePack<int, float> twoElemTypePack; |
| 7 | |
| 8 | // Unnamed type parameter pack. |
| 9 | template <typename... > |
| 10 | struct AnonTypePack { int b; }; |
| 11 | AnonTypePack<> emptyAnonTypePack; |
| 12 | AnonTypePack<int> oneElemAnonTypePack; |
| 13 | AnonTypePack<int, float> twoElemAnonTypePack; |
| 14 | |
| 15 | // Test type parameter packs combined with non-pack type template parameters. |
| 16 | |
| 17 | // Unnamed type parameter pack behind a named type parameter. |
| 18 | template <typename T, typename... > |
| 19 | struct AnonTypePackAfterTypeParam { T c; }; |
| 20 | AnonTypePackAfterTypeParam<int> emptyAnonTypePackAfterTypeParam; |
| 21 | AnonTypePackAfterTypeParam<int, float> oneElemAnonTypePackAfterTypeParam; |
| 22 | |
| 23 | // Unnamed type parameter pack behind an unnamed type parameter. |
| 24 | template <typename, typename... > |
| 25 | struct AnonTypePackAfterAnonTypeParam { float d; }; |
| 26 | AnonTypePackAfterAnonTypeParam<int> emptyAnonTypePackAfterAnonTypeParam; |
| 27 | AnonTypePackAfterAnonTypeParam<int, float> oneElemAnonTypePackAfterAnonTypeParam; |
| 28 | |
| 29 | // Named type parameter pack behind an unnamed type parameter. |
| 30 | template <typename, typename... Ts> |
| 31 | struct TypePackAfterAnonTypeParam { int e; }; |
| 32 | TypePackAfterAnonTypeParam<int> emptyTypePackAfterAnonTypeParam; |
| 33 | TypePackAfterAnonTypeParam<int, float> oneElemTypePackAfterAnonTypeParam; |
| 34 | |
| 35 | // Named type parameter pack behind a named type parameter. |
| 36 | template <typename T, typename... Ts> |
| 37 | struct TypePackAfterTypeParam { int f; }; |
| 38 | TypePackAfterTypeParam<int> emptyTypePackAfterTypeParam; |
| 39 | TypePackAfterTypeParam<int, float> oneElemTypePackAfterTypeParam; |
| 40 | |
| 41 | // Test type parameter packs combined with non-pack non-type template parameters. |
| 42 | |
| 43 | // Unnamed type parameter pack behind a named type parameter. |
| 44 | template <int I, typename... > |
| 45 | struct AnonTypePackAfterNonTypeParam { int g; }; |
| 46 | AnonTypePackAfterNonTypeParam<1> emptyAnonTypePackAfterNonTypeParam; |
| 47 | AnonTypePackAfterNonTypeParam<1, int> oneElemAnonTypePackAfterNonTypeParam; |
| 48 | |
| 49 | // Unnamed type parameter pack behind an unnamed type parameter. |
| 50 | template <int, typename... > |
| 51 | struct AnonTypePackAfterAnonNonTypeParam { float h; }; |
| 52 | AnonTypePackAfterAnonNonTypeParam<1> emptyAnonTypePackAfterAnonNonTypeParam; |
| 53 | AnonTypePackAfterAnonNonTypeParam<1, int> oneElemAnonTypePackAfterAnonNonTypeParam; |
| 54 | |
| 55 | // Named type parameter pack behind an unnamed type parameter. |
| 56 | template <int, typename... Ts> |
| 57 | struct TypePackAfterAnonNonTypeParam { int i; }; |
| 58 | TypePackAfterAnonNonTypeParam<1> emptyTypePackAfterAnonNonTypeParam; |
| 59 | TypePackAfterAnonNonTypeParam<1, int> oneElemTypePackAfterAnonNonTypeParam; |
| 60 | |
| 61 | // Named type parameter pack behind an unnamed type parameter. |
| 62 | template <int I, typename... Ts> |
| 63 | struct TypePackAfterNonTypeParam { int j; }; |
| 64 | TypePackAfterNonTypeParam<1> emptyTypePackAfterNonTypeParam; |
| 65 | TypePackAfterNonTypeParam<1, int> oneElemTypePackAfterNonTypeParam; |
| 66 | |
| 67 | int main() { |
| 68 | return 0; // break here |
| 69 | } |
| 70 | |