1 template <class T, int... Args> struct C { 2 T member; 3 bool isSixteenThirtyTwo() { return false; } 4 }; 5 6 template <> struct C<int, 16> { 7 int member; 8 bool isSixteenThirtyTwo() { return false; } 9 }; 10 11 template <> struct C<int, 16, 32> : C<int, 16> { 12 bool isSixteenThirtyTwo() { return true; } 13 }; 14 15 template <class T, typename... Args> struct D { 16 T member; 17 bool isIntBool() { return false; } 18 }; 19 20 template <> struct D<int, int> { 21 int member; 22 bool isIntBool() { return false; } 23 }; 24 25 template <> struct D<int, int, bool> : D<int, int> { 26 bool isIntBool() { return true; } 27 }; 28 29 template<int Size> struct array { 30 int Arr[Size]; 31 array() {} 32 }; 33 34 int main (int argc, char const *argv[]) 35 { 36 C<int,16,32> myC; 37 C<int,16> myLesserC; 38 myC.member = 64; 39 (void)C<int,16,32>().isSixteenThirtyTwo(); 40 (void)C<int,16>().isSixteenThirtyTwo(); 41 (void)(myC.member != 64); //% self.expect("expression -- myC", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"]) 42 //% self.expect("expression -- myLesserC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) 43 //% self.expect("expression -- myC.isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) 44 45 // Disabling until we do template lookup correctly: http://lists.llvm.org/pipermail/lldb-commits/Week-of-Mon-20180507/040689.html 46 //#% self.expect("expression -- C<int, 16>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) 47 //#% self.expect("expression -- C<int, 16, 32>().isSixteenThirtyTwo()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) 48 49 D<int,int,bool> myD; 50 D<int,int> myLesserD; 51 myD.member = 64; 52 (void)D<int,int,bool>().isIntBool(); 53 (void)D<int,int>().isIntBool(); //% self.expect("expression -- myD", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["64"]) 54 //% self.expect("expression -- myLesserD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) 55 //% self.expect("expression -- myD.isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) 56 57 // See comment above. 58 //#% self.expect("expression -- D<int, int>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["false"]) 59 //#% self.expect("expression -- D<int, int, bool>().isIntBool()", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["true"]) 60 61 array<3> myArray; //% self.expect("expression -- myArray", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["Arr"]) 62 63 return 1; 64 } 65