| 1 | // Named type parameter pack. |
| 2 | template <int... Is> |
| 3 | struct NonTypePack { int a; }; |
| 4 | NonTypePack<> emptyNonTypePack; |
| 5 | NonTypePack<1> oneElemNonTypePack; |
| 6 | NonTypePack<1, 2> twoElemNonTypePack; |
| 7 | |
| 8 | // Unnamed type parameter pack. |
| 9 | template <int... > |
| 10 | struct AnonNonTypePack { int b; }; |
| 11 | AnonNonTypePack<> emptyAnonNonTypePack; |
| 12 | AnonNonTypePack<1> oneElemAnonNonTypePack; |
| 13 | AnonNonTypePack<1, 2> twoElemAnonNonTypePack; |
| 14 | |
| 15 | // Test type parameter packs combined with non-pack type template parameters. |
| 16 | |
| 17 | // Unnamed non-type parameter pack behind a named type parameter. |
| 18 | template <typename T, int... > |
| 19 | struct AnonNonTypePackAfterTypeParam { T c; }; |
| 20 | AnonNonTypePackAfterTypeParam<int> emptyAnonNonTypePackAfterTypeParam; |
| 21 | AnonNonTypePackAfterTypeParam<int, 1> oneElemAnonNonTypePackAfterTypeParam; |
| 22 | |
| 23 | // Unnamed non-type parameter pack behind an unnamed type parameter. |
| 24 | template <typename, int... > |
| 25 | struct AnonNonTypePackAfterAnonTypeParam { float d; }; |
| 26 | AnonNonTypePackAfterAnonTypeParam<int> emptyAnonNonTypePackAfterAnonTypeParam; |
| 27 | AnonNonTypePackAfterAnonTypeParam<int, 1> oneElemAnonNonTypePackAfterAnonTypeParam; |
| 28 | |
| 29 | // Named non-type parameter pack behind an unnamed type parameter. |
| 30 | template <typename, int... Is> |
| 31 | struct NonTypePackAfterAnonTypeParam { int e; }; |
| 32 | NonTypePackAfterAnonTypeParam<int> emptyNonTypePackAfterAnonTypeParam; |
| 33 | NonTypePackAfterAnonTypeParam<int, 1> oneElemNonTypePackAfterAnonTypeParam; |
| 34 | |
| 35 | // Named non-type parameter pack behind a named type parameter. |
| 36 | template <typename T, int... Is> |
| 37 | struct NonTypePackAfterTypeParam { int f; }; |
| 38 | NonTypePackAfterTypeParam<int> emptyNonTypePackAfterTypeParam; |
| 39 | NonTypePackAfterTypeParam<int, 1> oneElemNonTypePackAfterTypeParam; |
| 40 | |
| 41 | // Test non-type parameter packs combined with non-pack non-type template parameters. |
| 42 | |
| 43 | // Unnamed non-type parameter pack behind a named non-type parameter. |
| 44 | template <int I, int... > |
| 45 | struct AnonNonTypePackAfterNonTypeParam { int g; }; |
| 46 | AnonNonTypePackAfterNonTypeParam<1> emptyAnonNonTypePackAfterNonTypeParam; |
| 47 | AnonNonTypePackAfterNonTypeParam<1, 2> oneElemAnonNonTypePackAfterNonTypeParam; |
| 48 | |
| 49 | // Unnamed non-type parameter pack behind an unnamed non-type parameter. |
| 50 | template <int, int... > |
| 51 | struct AnonNonTypePackAfterAnonNonTypeParam { float h; }; |
| 52 | AnonNonTypePackAfterAnonNonTypeParam<1> emptyAnonNonTypePackAfterAnonNonTypeParam; |
| 53 | AnonNonTypePackAfterAnonNonTypeParam<1, 2> oneElemAnonNonTypePackAfterAnonNonTypeParam; |
| 54 | |
| 55 | // Named non-type parameter pack behind an unnamed non-type parameter. |
| 56 | template <int, int... Is> |
| 57 | struct NonTypePackAfterAnonNonTypeParam { int i; }; |
| 58 | NonTypePackAfterAnonNonTypeParam<1> emptyNonTypePackAfterAnonNonTypeParam; |
| 59 | NonTypePackAfterAnonNonTypeParam<1, 2> oneElemNonTypePackAfterAnonNonTypeParam; |
| 60 | |
| 61 | // Named non-type parameter pack behind an unnamed non-type parameter. |
| 62 | template <int I, int... Is> |
| 63 | struct NonTypePackAfterNonTypeParam { int j; }; |
| 64 | NonTypePackAfterNonTypeParam<1> emptyNonTypePackAfterNonTypeParam; |
| 65 | NonTypePackAfterNonTypeParam<1, 2> oneElemNonTypePackAfterNonTypeParam; |
| 66 | |
| 67 | int main() { |
| 68 | return 0; // break here |
| 69 | } |
| 70 | |