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

source code of lldb/test/API/lang/cpp/class-template-non-type-parameter-pack/main.cpp