xref: /minix3/external/bsd/llvm/dist/clang/test/SemaTemplate/temp_class_spec.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc template<typename T>
3*f4a2713aSLionel Sambuc struct is_pointer {
4*f4a2713aSLionel Sambuc   static const bool value = false;
5*f4a2713aSLionel Sambuc };
6*f4a2713aSLionel Sambuc 
7*f4a2713aSLionel Sambuc template<typename T>
8*f4a2713aSLionel Sambuc struct is_pointer<T*> {
9*f4a2713aSLionel Sambuc   static const bool value = true;
10*f4a2713aSLionel Sambuc };
11*f4a2713aSLionel Sambuc 
12*f4a2713aSLionel Sambuc template<typename T>
13*f4a2713aSLionel Sambuc struct is_pointer<const T*> {
14*f4a2713aSLionel Sambuc   static const bool value = true;
15*f4a2713aSLionel Sambuc };
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc int array0[is_pointer<int>::value? -1 : 1];
18*f4a2713aSLionel Sambuc int array1[is_pointer<int*>::value? 1 : -1];
19*f4a2713aSLionel Sambuc int array2[is_pointer<const int*>::value? 1 : -1];
20*f4a2713aSLionel Sambuc 
21*f4a2713aSLionel Sambuc template<typename T>
22*f4a2713aSLionel Sambuc struct is_lvalue_reference {
23*f4a2713aSLionel Sambuc   static const bool value = false;
24*f4a2713aSLionel Sambuc };
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc template<typename T>
27*f4a2713aSLionel Sambuc struct is_lvalue_reference<T&> {
28*f4a2713aSLionel Sambuc   static const bool value = true;
29*f4a2713aSLionel Sambuc };
30*f4a2713aSLionel Sambuc 
31*f4a2713aSLionel Sambuc int lvalue_ref0[is_lvalue_reference<int>::value? -1 : 1];
32*f4a2713aSLionel Sambuc int lvalue_ref1[is_lvalue_reference<const int&>::value? 1 : -1];
33*f4a2713aSLionel Sambuc 
34*f4a2713aSLionel Sambuc template<typename T>
35*f4a2713aSLionel Sambuc struct is_const {
36*f4a2713aSLionel Sambuc   static const bool value = false;
37*f4a2713aSLionel Sambuc };
38*f4a2713aSLionel Sambuc 
39*f4a2713aSLionel Sambuc template<typename T>
40*f4a2713aSLionel Sambuc struct is_const<const T> {
41*f4a2713aSLionel Sambuc   static const bool value = true;
42*f4a2713aSLionel Sambuc };
43*f4a2713aSLionel Sambuc 
44*f4a2713aSLionel Sambuc int is_const0[is_const<int>::value? -1 : 1];
45*f4a2713aSLionel Sambuc int is_const1[is_const<const int>::value? 1 : -1];
46*f4a2713aSLionel Sambuc int is_const2[is_const<const volatile int>::value? 1 : -1];
47*f4a2713aSLionel Sambuc int is_const3[is_const<const int [3]>::value? 1 : -1];
48*f4a2713aSLionel Sambuc int is_const4[is_const<const volatile int[3]>::value? 1 : -1];
49*f4a2713aSLionel Sambuc int is_const5[is_const<volatile int[3]>::value? -1 : 1];
50*f4a2713aSLionel Sambuc 
51*f4a2713aSLionel Sambuc template<typename T>
52*f4a2713aSLionel Sambuc struct is_volatile {
53*f4a2713aSLionel Sambuc   static const bool value = false;
54*f4a2713aSLionel Sambuc };
55*f4a2713aSLionel Sambuc 
56*f4a2713aSLionel Sambuc template<typename T>
57*f4a2713aSLionel Sambuc struct is_volatile<volatile T> {
58*f4a2713aSLionel Sambuc   static const bool value = true;
59*f4a2713aSLionel Sambuc };
60*f4a2713aSLionel Sambuc 
61*f4a2713aSLionel Sambuc int is_volatile0[is_volatile<int>::value? -1 : 1];
62*f4a2713aSLionel Sambuc int is_volatile1[is_volatile<volatile int>::value? 1 : -1];
63*f4a2713aSLionel Sambuc int is_volatile2[is_volatile<const volatile int>::value? 1 : -1];
64*f4a2713aSLionel Sambuc int is_volatile3[is_volatile<volatile char[3]>::value? 1 : -1];
65*f4a2713aSLionel Sambuc 
66*f4a2713aSLionel Sambuc template<typename T, typename U>
67*f4a2713aSLionel Sambuc struct is_same {
68*f4a2713aSLionel Sambuc   static const bool value = false;
69*f4a2713aSLionel Sambuc };
70*f4a2713aSLionel Sambuc 
71*f4a2713aSLionel Sambuc template<typename T>
72*f4a2713aSLionel Sambuc struct is_same<T, T> {
73*f4a2713aSLionel Sambuc   static const bool value = true;
74*f4a2713aSLionel Sambuc };
75*f4a2713aSLionel Sambuc 
76*f4a2713aSLionel Sambuc typedef int INT;
77*f4a2713aSLionel Sambuc typedef INT* int_ptr;
78*f4a2713aSLionel Sambuc 
79*f4a2713aSLionel Sambuc int is_same0[is_same<int, int>::value? 1 : -1];
80*f4a2713aSLionel Sambuc int is_same1[is_same<int, INT>::value? 1 : -1];
81*f4a2713aSLionel Sambuc int is_same2[is_same<const int, int>::value? -1 : 1];
82*f4a2713aSLionel Sambuc int is_same3[is_same<int_ptr, int>::value? -1 : 1];
83*f4a2713aSLionel Sambuc 
84*f4a2713aSLionel Sambuc template<typename T>
85*f4a2713aSLionel Sambuc struct remove_reference {
86*f4a2713aSLionel Sambuc   typedef T type;
87*f4a2713aSLionel Sambuc };
88*f4a2713aSLionel Sambuc 
89*f4a2713aSLionel Sambuc template<typename T>
90*f4a2713aSLionel Sambuc struct remove_reference<T&> {
91*f4a2713aSLionel Sambuc   typedef T type;
92*f4a2713aSLionel Sambuc };
93*f4a2713aSLionel Sambuc 
94*f4a2713aSLionel Sambuc int remove_ref0[is_same<remove_reference<int>::type, int>::value? 1 : -1];
95*f4a2713aSLionel Sambuc int remove_ref1[is_same<remove_reference<int&>::type, int>::value? 1 : -1];
96*f4a2713aSLionel Sambuc 
97*f4a2713aSLionel Sambuc template<typename T>
98*f4a2713aSLionel Sambuc struct remove_const {
99*f4a2713aSLionel Sambuc   typedef T type;
100*f4a2713aSLionel Sambuc };
101*f4a2713aSLionel Sambuc 
102*f4a2713aSLionel Sambuc template<typename T>
103*f4a2713aSLionel Sambuc struct remove_const<const T> {
104*f4a2713aSLionel Sambuc   typedef T type;
105*f4a2713aSLionel Sambuc };
106*f4a2713aSLionel Sambuc 
107*f4a2713aSLionel Sambuc int remove_const0[is_same<remove_const<const int>::type, int>::value? 1 : -1];
108*f4a2713aSLionel Sambuc int remove_const1[is_same<remove_const<const int[3]>::type, int[3]>::value? 1 : -1];
109*f4a2713aSLionel Sambuc 
110*f4a2713aSLionel Sambuc template<typename T>
111*f4a2713aSLionel Sambuc struct is_incomplete_array {
112*f4a2713aSLionel Sambuc   static const bool value = false;
113*f4a2713aSLionel Sambuc };
114*f4a2713aSLionel Sambuc 
115*f4a2713aSLionel Sambuc template<typename T>
116*f4a2713aSLionel Sambuc struct is_incomplete_array<T[]> {
117*f4a2713aSLionel Sambuc   static const bool value = true;
118*f4a2713aSLionel Sambuc };
119*f4a2713aSLionel Sambuc 
120*f4a2713aSLionel Sambuc int incomplete_array0[is_incomplete_array<int>::value ? -1 : 1];
121*f4a2713aSLionel Sambuc int incomplete_array1[is_incomplete_array<int[1]>::value ? -1 : 1];
122*f4a2713aSLionel Sambuc int incomplete_array2[is_incomplete_array<bool[]>::value ? 1 : -1];
123*f4a2713aSLionel Sambuc int incomplete_array3[is_incomplete_array<int[]>::value ? 1 : -1];
124*f4a2713aSLionel Sambuc 
125*f4a2713aSLionel Sambuc template<typename T>
126*f4a2713aSLionel Sambuc struct is_array_with_4_elements {
127*f4a2713aSLionel Sambuc   static const bool value = false;
128*f4a2713aSLionel Sambuc };
129*f4a2713aSLionel Sambuc 
130*f4a2713aSLionel Sambuc template<typename T>
131*f4a2713aSLionel Sambuc struct is_array_with_4_elements<T[4]> {
132*f4a2713aSLionel Sambuc   static const bool value = true;
133*f4a2713aSLionel Sambuc };
134*f4a2713aSLionel Sambuc 
135*f4a2713aSLionel Sambuc int array_with_4_elements0[is_array_with_4_elements<int[]>::value ? -1 : 1];
136*f4a2713aSLionel Sambuc int array_with_4_elements1[is_array_with_4_elements<int[1]>::value ? -1 : 1];
137*f4a2713aSLionel Sambuc int array_with_4_elements2[is_array_with_4_elements<int[4]>::value ? 1 : -1];
138*f4a2713aSLionel Sambuc int array_with_4_elements3[is_array_with_4_elements<int[4][2]>::value ? 1 : -1];
139*f4a2713aSLionel Sambuc 
140*f4a2713aSLionel Sambuc template<typename T>
141*f4a2713aSLionel Sambuc struct get_array_size;
142*f4a2713aSLionel Sambuc 
143*f4a2713aSLionel Sambuc template<typename T, unsigned N>
144*f4a2713aSLionel Sambuc struct get_array_size<T[N]> {
145*f4a2713aSLionel Sambuc   static const unsigned value = N;
146*f4a2713aSLionel Sambuc };
147*f4a2713aSLionel Sambuc 
148*f4a2713aSLionel Sambuc int array_size0[get_array_size<int[12]>::value == 12? 1 : -1];
149*f4a2713aSLionel Sambuc 
150*f4a2713aSLionel Sambuc template<typename T>
151*f4a2713aSLionel Sambuc struct remove_extent {
152*f4a2713aSLionel Sambuc   typedef T type;
153*f4a2713aSLionel Sambuc };
154*f4a2713aSLionel Sambuc 
155*f4a2713aSLionel Sambuc template<typename T>
156*f4a2713aSLionel Sambuc struct remove_extent<T[]> {
157*f4a2713aSLionel Sambuc   typedef T type;
158*f4a2713aSLionel Sambuc };
159*f4a2713aSLionel Sambuc 
160*f4a2713aSLionel Sambuc template<typename T, unsigned N>
161*f4a2713aSLionel Sambuc struct remove_extent<T[N]> {
162*f4a2713aSLionel Sambuc   typedef T type;
163*f4a2713aSLionel Sambuc };
164*f4a2713aSLionel Sambuc 
165*f4a2713aSLionel Sambuc int remove_extent0[is_same<remove_extent<int[][5]>::type, int[5]>::value? 1 : -1];
166*f4a2713aSLionel Sambuc int remove_extent1[is_same<remove_extent<const int[][5]>::type, const int[5]>::value? 1 : -1];
167*f4a2713aSLionel Sambuc 
168*f4a2713aSLionel Sambuc template<typename T>
169*f4a2713aSLionel Sambuc struct is_unary_function {
170*f4a2713aSLionel Sambuc   static const bool value = false;
171*f4a2713aSLionel Sambuc };
172*f4a2713aSLionel Sambuc 
173*f4a2713aSLionel Sambuc template<typename T, typename U>
174*f4a2713aSLionel Sambuc struct is_unary_function<T (*)(U)> {
175*f4a2713aSLionel Sambuc   static const bool value = true;
176*f4a2713aSLionel Sambuc };
177*f4a2713aSLionel Sambuc 
178*f4a2713aSLionel Sambuc int is_unary_function0[is_unary_function<int>::value ? -1 : 1];
179*f4a2713aSLionel Sambuc int is_unary_function1[is_unary_function<int (*)()>::value ? -1 : 1];
180*f4a2713aSLionel Sambuc int is_unary_function2[is_unary_function<int (*)(int, bool)>::value ? -1 : 1];
181*f4a2713aSLionel Sambuc int is_unary_function3[is_unary_function<int (*)(bool)>::value ? 1 : -1];
182*f4a2713aSLionel Sambuc int is_unary_function4[is_unary_function<int (*)(int)>::value ? 1 : -1];
183*f4a2713aSLionel Sambuc 
184*f4a2713aSLionel Sambuc template<typename T>
185*f4a2713aSLionel Sambuc struct is_unary_function_with_same_return_type_as_argument_type {
186*f4a2713aSLionel Sambuc   static const bool value = false;
187*f4a2713aSLionel Sambuc };
188*f4a2713aSLionel Sambuc 
189*f4a2713aSLionel Sambuc template<typename T>
190*f4a2713aSLionel Sambuc struct is_unary_function_with_same_return_type_as_argument_type<T (*)(T)> {
191*f4a2713aSLionel Sambuc   static const bool value = true;
192*f4a2713aSLionel Sambuc };
193*f4a2713aSLionel Sambuc 
194*f4a2713aSLionel Sambuc int is_unary_function5[is_unary_function_with_same_return_type_as_argument_type<int>::value ? -1 : 1];
195*f4a2713aSLionel Sambuc int is_unary_function6[is_unary_function_with_same_return_type_as_argument_type<int (*)()>::value ? -1 : 1];
196*f4a2713aSLionel Sambuc int is_unary_function7[is_unary_function_with_same_return_type_as_argument_type<int (*)(int, bool)>::value ? -1 : 1];
197*f4a2713aSLionel Sambuc int is_unary_function8[is_unary_function_with_same_return_type_as_argument_type<int (*)(bool)>::value ? -1 : 1];
198*f4a2713aSLionel Sambuc int is_unary_function9[is_unary_function_with_same_return_type_as_argument_type<int (*)(int)>::value ? 1 : -1];
199*f4a2713aSLionel Sambuc int is_unary_function10[is_unary_function_with_same_return_type_as_argument_type<int (*)(int, ...)>::value ? -1 : 1];
200*f4a2713aSLionel Sambuc int is_unary_function11[is_unary_function_with_same_return_type_as_argument_type<int (* const)(int)>::value ? -1 : 1];
201*f4a2713aSLionel Sambuc 
202*f4a2713aSLionel Sambuc template<typename T>
203*f4a2713aSLionel Sambuc struct is_binary_function {
204*f4a2713aSLionel Sambuc   static const bool value = false;
205*f4a2713aSLionel Sambuc };
206*f4a2713aSLionel Sambuc 
207*f4a2713aSLionel Sambuc template<typename R, typename T1, typename T2>
208*f4a2713aSLionel Sambuc struct is_binary_function<R(T1, T2)> {
209*f4a2713aSLionel Sambuc   static const bool value = true;
210*f4a2713aSLionel Sambuc };
211*f4a2713aSLionel Sambuc 
212*f4a2713aSLionel Sambuc int is_binary_function0[is_binary_function<int(float, double)>::value? 1 : -1];
213*f4a2713aSLionel Sambuc 
214*f4a2713aSLionel Sambuc template<typename T>
215*f4a2713aSLionel Sambuc struct is_member_pointer {
216*f4a2713aSLionel Sambuc   static const bool value = false;
217*f4a2713aSLionel Sambuc };
218*f4a2713aSLionel Sambuc 
219*f4a2713aSLionel Sambuc template<typename T, typename Class>
220*f4a2713aSLionel Sambuc struct is_member_pointer<T Class::*> {
221*f4a2713aSLionel Sambuc   static const bool value = true;
222*f4a2713aSLionel Sambuc };
223*f4a2713aSLionel Sambuc 
224*f4a2713aSLionel Sambuc struct X { };
225*f4a2713aSLionel Sambuc 
226*f4a2713aSLionel Sambuc int is_member_pointer0[is_member_pointer<int X::*>::value? 1 : -1];
227*f4a2713aSLionel Sambuc int is_member_pointer1[is_member_pointer<const int X::*>::value? 1 : -1];
228*f4a2713aSLionel Sambuc int is_member_pointer2[is_member_pointer<int (X::*)()>::value? 1 : -1];
229*f4a2713aSLionel Sambuc int is_member_pointer3[is_member_pointer<int (X::*)(int) const>::value? 1 : -1];
230*f4a2713aSLionel Sambuc int is_member_pointer4[is_member_pointer<int (X::**)(int) const>::value? -1 : 1];
231*f4a2713aSLionel Sambuc int is_member_pointer5[is_member_pointer<int>::value? -1 : 1];
232*f4a2713aSLionel Sambuc 
233*f4a2713aSLionel Sambuc template<typename T>
234*f4a2713aSLionel Sambuc struct is_member_function_pointer {
235*f4a2713aSLionel Sambuc   static const bool value = false;
236*f4a2713aSLionel Sambuc };
237*f4a2713aSLionel Sambuc 
238*f4a2713aSLionel Sambuc template<typename T, typename Class>
239*f4a2713aSLionel Sambuc struct is_member_function_pointer<T (Class::*)()> {
240*f4a2713aSLionel Sambuc   static const bool value = true;
241*f4a2713aSLionel Sambuc };
242*f4a2713aSLionel Sambuc 
243*f4a2713aSLionel Sambuc template<typename T, typename Class>
244*f4a2713aSLionel Sambuc struct is_member_function_pointer<T (Class::*)() const> {
245*f4a2713aSLionel Sambuc   static const bool value = true;
246*f4a2713aSLionel Sambuc };
247*f4a2713aSLionel Sambuc 
248*f4a2713aSLionel Sambuc template<typename T, typename Class>
249*f4a2713aSLionel Sambuc struct is_member_function_pointer<T (Class::*)() volatile> {
250*f4a2713aSLionel Sambuc   static const bool value = true;
251*f4a2713aSLionel Sambuc };
252*f4a2713aSLionel Sambuc 
253*f4a2713aSLionel Sambuc template<typename T, typename Class>
254*f4a2713aSLionel Sambuc struct is_member_function_pointer<T (Class::*)() const volatile> {
255*f4a2713aSLionel Sambuc   static const bool value = true;
256*f4a2713aSLionel Sambuc };
257*f4a2713aSLionel Sambuc 
258*f4a2713aSLionel Sambuc template<typename T, typename Class, typename A1>
259*f4a2713aSLionel Sambuc struct is_member_function_pointer<T (Class::*)(A1)> {
260*f4a2713aSLionel Sambuc   static const bool value = true;
261*f4a2713aSLionel Sambuc };
262*f4a2713aSLionel Sambuc 
263*f4a2713aSLionel Sambuc template<typename T, typename Class, typename A1>
264*f4a2713aSLionel Sambuc struct is_member_function_pointer<T (Class::*)(A1) const> {
265*f4a2713aSLionel Sambuc   static const bool value = true;
266*f4a2713aSLionel Sambuc };
267*f4a2713aSLionel Sambuc 
268*f4a2713aSLionel Sambuc template<typename T, typename Class, typename A1>
269*f4a2713aSLionel Sambuc struct is_member_function_pointer<T (Class::*)(A1) volatile> {
270*f4a2713aSLionel Sambuc   static const bool value = true;
271*f4a2713aSLionel Sambuc };
272*f4a2713aSLionel Sambuc 
273*f4a2713aSLionel Sambuc template<typename T, typename Class, typename A1>
274*f4a2713aSLionel Sambuc struct is_member_function_pointer<T (Class::*)(A1) const volatile> {
275*f4a2713aSLionel Sambuc   static const bool value = true;
276*f4a2713aSLionel Sambuc };
277*f4a2713aSLionel Sambuc 
278*f4a2713aSLionel Sambuc int is_member_function_pointer0[
279*f4a2713aSLionel Sambuc                           is_member_function_pointer<int X::*>::value? -1 : 1];
280*f4a2713aSLionel Sambuc int is_member_function_pointer1[
281*f4a2713aSLionel Sambuc                       is_member_function_pointer<int (X::*)()>::value? 1 : -1];
282*f4a2713aSLionel Sambuc int is_member_function_pointer2[
283*f4a2713aSLionel Sambuc                       is_member_function_pointer<X (X::*)(X&)>::value? 1 : -1];
284*f4a2713aSLionel Sambuc int is_member_function_pointer3[
285*f4a2713aSLionel Sambuc            is_member_function_pointer<int (X::*)() const>::value? 1 : -1];
286*f4a2713aSLionel Sambuc int is_member_function_pointer4[
287*f4a2713aSLionel Sambuc            is_member_function_pointer<int (X::*)(float) const>::value? 1 : -1];
288*f4a2713aSLionel Sambuc 
289*f4a2713aSLionel Sambuc // Test substitution of non-dependent arguments back into the template
290*f4a2713aSLionel Sambuc // argument list of the class template partial specialization.
291*f4a2713aSLionel Sambuc template<typename T, typename ValueType = T>
292*f4a2713aSLionel Sambuc struct is_nested_value_type_identity {
293*f4a2713aSLionel Sambuc   static const bool value = false;
294*f4a2713aSLionel Sambuc };
295*f4a2713aSLionel Sambuc 
296*f4a2713aSLionel Sambuc template<typename T>
297*f4a2713aSLionel Sambuc struct is_nested_value_type_identity<T, typename T::value_type> {
298*f4a2713aSLionel Sambuc   static const bool value = true;
299*f4a2713aSLionel Sambuc };
300*f4a2713aSLionel Sambuc 
301*f4a2713aSLionel Sambuc template<typename T>
302*f4a2713aSLionel Sambuc struct HasValueType {
303*f4a2713aSLionel Sambuc   typedef T value_type;
304*f4a2713aSLionel Sambuc };
305*f4a2713aSLionel Sambuc 
306*f4a2713aSLionel Sambuc struct HasIdentityValueType {
307*f4a2713aSLionel Sambuc   typedef HasIdentityValueType value_type;
308*f4a2713aSLionel Sambuc };
309*f4a2713aSLionel Sambuc 
310*f4a2713aSLionel Sambuc struct NoValueType { };
311*f4a2713aSLionel Sambuc 
312*f4a2713aSLionel Sambuc int is_nested_value_type_identity0[
313*f4a2713aSLionel Sambuc             is_nested_value_type_identity<HasValueType<int> >::value? -1 : 1];
314*f4a2713aSLionel Sambuc int is_nested_value_type_identity1[
315*f4a2713aSLionel Sambuc           is_nested_value_type_identity<HasIdentityValueType>::value? 1 : -1];
316*f4a2713aSLionel Sambuc int is_nested_value_type_identity2[
317*f4a2713aSLionel Sambuc                    is_nested_value_type_identity<NoValueType>::value? -1 : 1];
318*f4a2713aSLionel Sambuc 
319*f4a2713aSLionel Sambuc 
320*f4a2713aSLionel Sambuc // C++ [temp.class.spec]p4:
321*f4a2713aSLionel Sambuc template<class T1, class T2, int I> class A { }; //#1
322*f4a2713aSLionel Sambuc template<class T, int I> class A<T, T*, I> { }; //#2
323*f4a2713aSLionel Sambuc template<class T1, class T2, int I> class A<T1*, T2, I> { }; //#3
324*f4a2713aSLionel Sambuc template<class T> class A<int, T*, 5> { }; //#4
325*f4a2713aSLionel Sambuc template<class T1, class T2, int I> class A<T1, T2*, I> { }; //#5
326*f4a2713aSLionel Sambuc 
327*f4a2713aSLionel Sambuc // Redefinition of class template partial specializations
328*f4a2713aSLionel Sambuc template<typename T, T N, typename U> class A0;
329*f4a2713aSLionel Sambuc 
330*f4a2713aSLionel Sambuc template<typename T, T N> class A0<T, N, int> { }; // expected-note{{here}}
331*f4a2713aSLionel Sambuc template<typename T, T N> class A0<T, N, int>;
332*f4a2713aSLionel Sambuc template<typename T, T N> class A0<T, N, int> { }; // expected-error{{redef}}
333*f4a2713aSLionel Sambuc 
334*f4a2713aSLionel Sambuc namespace PR6025 {
335*f4a2713aSLionel Sambuc   template< int N > struct A;
336*f4a2713aSLionel Sambuc 
337*f4a2713aSLionel Sambuc   namespace N
338*f4a2713aSLionel Sambuc   {
339*f4a2713aSLionel Sambuc     template< typename F >
340*f4a2713aSLionel Sambuc     struct B;
341*f4a2713aSLionel Sambuc   }
342*f4a2713aSLionel Sambuc 
343*f4a2713aSLionel Sambuc   template< typename Protect, typename Second >
344*f4a2713aSLionel Sambuc   struct C;
345*f4a2713aSLionel Sambuc 
346*f4a2713aSLionel Sambuc   template <class T>
347*f4a2713aSLionel Sambuc   struct C< T, A< N::B<T>::value > >
348*f4a2713aSLionel Sambuc   {
349*f4a2713aSLionel Sambuc   };
350*f4a2713aSLionel Sambuc }
351*f4a2713aSLionel Sambuc 
352*f4a2713aSLionel Sambuc namespace PR6181 {
353*f4a2713aSLionel Sambuc   template <class T>
354*f4a2713aSLionel Sambuc   class a;
355*f4a2713aSLionel Sambuc 
356*f4a2713aSLionel Sambuc   class s;
357*f4a2713aSLionel Sambuc 
358*f4a2713aSLionel Sambuc   template <class U>
359*f4a2713aSLionel Sambuc   class a<s> // expected-error{{partial specialization of 'a' does not use any of its template parameters}}
360*f4a2713aSLionel Sambuc   {
361*f4a2713aSLionel Sambuc   };
362*f4a2713aSLionel Sambuc 
363*f4a2713aSLionel Sambuc }
364