Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / ASTMerge / class-template-partial-spec / Inputs / class-template-partial-spec1.cpp
blob43606d4d220bba6beb9b69e328e9ebf2d0352886
1 template<typename T, class P>
2 struct TwoOptionTemplate {};
4 template<typename T>
5 struct TwoOptionTemplate<T, char> {
6 int member;
7 };
10 template<typename T>
11 struct TwoOptionTemplate<T, double> {
12 float member;
15 template<typename T>
16 struct TwoOptionTemplate<T, T> {
17 T** member;
20 TwoOptionTemplate<int, char> X0;
21 TwoOptionTemplate<int, float> X1;
22 TwoOptionTemplate<void *, wchar_t> X2;
23 TwoOptionTemplate<long, long> X3;
24 TwoOptionTemplate<float, float> X4;
25 TwoOptionTemplate<long, long> SingleSource;
26 TwoOptionTemplate<char, double> SecondDoubleSource;
29 template<int I, class C>
30 struct IntTemplateSpec {};
32 template<class C>
33 struct IntTemplateSpec<4, C> {
34 C member;
37 template<int I>
38 struct IntTemplateSpec<I, void *> {
39 int member;
40 static constexpr int val = I;
43 template<int I>
44 struct IntTemplateSpec<I, double> {
45 char member;
46 static constexpr int val = I;
49 IntTemplateSpec<4, wchar_t> Y0;
50 IntTemplateSpec<5, void *> Y1;
51 IntTemplateSpec<1, long> Y2;
52 IntTemplateSpec<3, int> Y3;
53 //template<int I> constexpr int IntTemplateSpec<I, double>::val;
54 IntTemplateSpec<42, double> NumberSource;
55 static_assert(NumberSource.val == 42);
57 namespace One {
58 namespace Two {
59 // Just an empty namespace to ensure we can deal with multiple namespace decls.
64 namespace One {
65 namespace Two {
66 namespace Three {
68 template<class T>
69 class Parent {};
71 } // namespace Three
73 } // namespace Two
75 template<typename T, typename X>
76 struct Child1: public Two::Three::Parent<unsigned> {
77 char member;
80 template<class T>
81 struct Child1<T, One::Two::Three::Parent<T>> {
82 T member;
85 } // namespace One
87 One::Child1<int, double> Z0Source;
89 // Test import of nested namespace specifiers
90 template<typename T>
91 struct Outer {
92 template<typename U> class Inner0;
95 template<typename X>
96 template<typename Y>
97 class Outer<X>::Inner0 {
98 public:
99 void f(X, Y);
100 template<typename Z> struct Inner1;
103 template<typename X>
104 template<typename Y>
105 void Outer<X>::Inner0<Y>::f(X, Y) {}
107 template<typename X>
108 template<typename Y>
109 template<typename Z>
110 class Outer<X>::Inner0<Y>::Inner1 {
111 public:
112 void f(Y, Z);
115 template<typename X>
116 template<typename Y>
117 template<typename Z>
118 void Outer<X>::Inner0<Y>::Inner1<Z>::f(Y, Z) {}