Reid Kleckner | 0333dd9 | 2019-05-14 18:51:07 +0000 | [diff] [blame] | 1 | template<typename T, typename P> |
| 2 | struct TwoOptionTemplate {}; |
| 3 | |
| 4 | template<typename T> |
| 5 | struct TwoOptionTemplate<T, char> { |
| 6 | int member; |
| 7 | }; |
| 8 | |
| 9 | |
| 10 | template<typename T> |
| 11 | struct TwoOptionTemplate<T, double> { |
| 12 | float member; |
| 13 | }; |
| 14 | |
| 15 | template<typename T> |
| 16 | struct TwoOptionTemplate<T, T> { |
| 17 | T** member; |
| 18 | }; |
| 19 | |
| 20 | TwoOptionTemplate<int, char> X0; |
| 21 | TwoOptionTemplate<int, double> X1; |
| 22 | TwoOptionTemplate<void *, wchar_t> X2; |
| 23 | TwoOptionTemplate<long, long> X3; |
| 24 | TwoOptionTemplate<int, int> X4; |
| 25 | TwoOptionTemplate<long, long> SingleDest; |
| 26 | TwoOptionTemplate<int, double> SecondDoubleDest; |
| 27 | |
| 28 | |
| 29 | template<int I, class C> |
| 30 | struct IntTemplateSpec {}; |
| 31 | |
| 32 | template<class C> |
| 33 | struct IntTemplateSpec<4, C> { |
| 34 | C member; |
| 35 | }; |
| 36 | |
| 37 | template<int I> |
| 38 | struct IntTemplateSpec<I, void *> { |
| 39 | double member; |
| 40 | static constexpr int val = I; |
| 41 | }; |
| 42 | |
| 43 | template<int I> |
| 44 | struct IntTemplateSpec<I, double> { |
| 45 | char member; |
| 46 | static constexpr int val = I; |
| 47 | }; |
| 48 | |
| 49 | IntTemplateSpec<4, wchar_t>Y0; |
| 50 | IntTemplateSpec<5, void *> Y1; |
| 51 | IntTemplateSpec<1, int> Y2; |
| 52 | IntTemplateSpec<2, int> Y3; |
| 53 | IntTemplateSpec<43, double> NumberDest; |
| 54 | |
| 55 | namespace One { |
| 56 | namespace Two { |
| 57 | namespace Three { |
| 58 | |
| 59 | template<class T> |
| 60 | class Parent {}; |
| 61 | |
| 62 | } // namespace Three |
| 63 | |
| 64 | } // namespace Two |
| 65 | |
| 66 | template<typename T, typename X> |
| 67 | struct Child1: public Two::Three::Parent<unsigned> { |
| 68 | char member; |
| 69 | }; |
| 70 | |
| 71 | template<class T> |
| 72 | struct Child1<T, One::Two::Three::Parent<T>> { |
| 73 | T member; |
| 74 | }; |
| 75 | |
| 76 | } // namespace One |
| 77 | |
| 78 | namespace Dst { One::Child1<double, One::Two::Three::Parent<double>> Z0Dst; } |
| 79 | One::Child1<int, float> Z1; |