1 // RUN: %clang_cc1 -fsyntax-only -verify %s
5 // Test typeof(expr) canonicalization
7 void f0(T x
, __typeof__(f(x
)) y
) { } // expected-note{{previous}}
10 void f0(T x
, __typeof__((f
)(x
)) y
) { }
13 void f0(U u
, __typeof__(f(u
))) { } // expected-error{{redefinition}}
15 // Test insane typeof(expr) overload set canonicalization
19 template<typename T
, T N
>
20 void f0a(T x
, __typeof__(f(N
)) y
) { } // expected-note{{previous}}
24 template<typename T
, T N
>
25 void f0a(T x
, __typeof__(f(N
)) y
) { } // expected-error{{redefinition}}
29 // Test dependently-sized array canonicalization
30 template<typename T
, int N
, int M
>
31 void f1(T (&array
)[N
+ M
]) { } // expected-note{{previous}}
33 template<typename T
, int N
, int M
>
34 void f1(T (&array
)[M
+ N
]) { }
36 template<typename T
, int M
, int N
>
37 void f1(T (&array
)[M
+ N
]) { } // expected-error{{redefinition}}
39 // Test dependently-sized extended vector type canonicalization
40 template<typename T
, int N
, int M
>
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
;
46 void f0(type1
); // expected-note{{previous}}
48 void f0(type3
); // expected-error{{redeclared}}
51 // Test canonicalization doesn't conflate different literal suffixes.
52 template<typename T
> void literal_suffix(int (&)[sizeof(T() + 0)]) {}
53 template<typename T
> void literal_suffix(int (&)[sizeof(T() + 0L)]) {}
54 template<typename T
> void literal_suffix(int (&)[sizeof(T() + 0LL)]) {}
55 template<typename T
> void literal_suffix(int (&)[sizeof(T() + 0.f
)]) {}
56 template<typename T
> void literal_suffix(int (&)[sizeof(T() + 0.)]) {}
57 template<typename T
> void literal_suffix(int (&)[sizeof(T() + 0.l
)]) {}