1 // RUN: clang-cc -fsyntax-only -verify %s
2 
3 void f();
4 
5 // FIXME: would like to refer to the first function parameter in these test,
6 // but that won't work (yet).
7 
8 // Test typeof(expr) canonicalization
9 template<typename T, T N>
10 void f0(T x, __typeof__(f(N)) y) { } // expected-note{{previous}}
11 
12 template<typename T, T N>
13 void f0(T x, __typeof__((f)(N)) y) { }
14 
15 template<typename U, U M>
16 void f0(U u, __typeof__(f(M))) { } // expected-error{{redefinition}}
17 
18 // Test insane typeof(expr) overload set canonicalization
19 void f(int);
20 void f(double);
21 
22 template<typename T, T N>
23 void f0a(T x, __typeof__(f(N)) y) { } // expected-note{{previous}}
24 
25 void f(int);
26 
27 template<typename T, T N>
28 void f0a(T x, __typeof__(f(N)) y) { } // expected-error{{redefinition}}
29 
30 void f(float);
31 
32 template<typename T, T N>
33 void f0a(T x, __typeof__(f(N)) y) { }
34 
35 // Test dependently-sized array canonicalization
36 template<typename T, int N, int M>
37 void f1(T (&array)[N + M]) { } // expected-note{{previous}}
38 
39 template<typename T, int N, int M>
40 void f1(T (&array)[M + N]) { }
41 
42 template<typename T, int M, int N>
43 void f1(T (&array)[M + N]) { } // expected-error{{redefinition}}
44 
45 // Test dependently-sized extended vector type canonicalization
46 template<typename T, int N, int M>
47 struct X2 {
48   typedef T __attribute__((ext_vector_type(N))) type1;
49   typedef T __attribute__((ext_vector_type(M))) type2;
50   typedef T __attribute__((ext_vector_type(N))) type3;
51 
52   void f0(type1); // expected-note{{previous}}
53   void f0(type2);
54   void f0(type3); // expected-error{{redeclared}}
55 };
56