xref: /llvm-project/lldb/test/API/lang/cpp/class-template-parameter-pack/main.cpp (revision b706f56133a77f9d7c55270ac24ff59e6fce3fa4)
1 template <class T, int... Args> struct C {
2   T member;
argsAre_16_32C3   bool argsAre_16_32() { return false; }
4 };
5 
6 template <> struct C<int, 16> {
7   int member;
argsAre_16_32C8   bool argsAre_16_32() { return false; }
9 };
10 
11 template <> struct C<int, 16, 32> : C<int, 16> {
argsAre_16_32C12   bool argsAre_16_32() { return true; }
13 };
14 
15 template <class T, typename... Args> struct D {
16   T member;
argsAre_Int_boolD17   bool argsAre_Int_bool() { return false; }
18 };
19 
20 template <> struct D<int, int> {
21   int member;
argsAre_Int_boolD22   bool argsAre_Int_bool() { return false; }
23 };
24 
25 template <> struct D<int, int, bool> : D<int, int> {
argsAre_Int_boolD26   bool argsAre_Int_bool() { return true; }
27 };
28 
29 template <typename... Args> struct OnlyPack {};
30 template <typename T, typename... Args> struct EmptyPack {};
31 
main(int argc,char const * argv[])32 int main(int argc, char const *argv[]) {
33   EmptyPack<int> emptyPack;
34   OnlyPack<int, char, double, D<int, int, bool>> onlyPack;
35 
36   C<int, 16, 32> myC;
37   C<int, 16> myLesserC;
38   myC.member = 64;
39   (void)C<int, 16, 32>().argsAre_16_32();
40   (void)C<int, 16>().argsAre_16_32();
41   (void)(myC.member != 64);
42   D<int, int, bool> myD;
43   D<int, int> myLesserD; // breakpoint here
44   myD.member = 64;
45   (void)D<int, int, bool>().argsAre_Int_bool();
46   (void)D<int, int>().argsAre_Int_bool();
47 
48   return 0; // break here
49 }
50