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