1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 template<typename T
, unsigned Length
>
4 typedef T
__attribute__((ext_vector_type(Length
))) type
;
12 template<typename T
, unsigned Length
>
14 typedef T
__attribute__((ext_vector_type(Length
))) type
; // expected-error{{zero vector size}}
18 make2
<int, 0> x
; // expected-note{{in instantiation of}}
21 template<typename T
, unsigned Length
>
23 typedef T
__attribute__((ext_vector_type(Length
))) type
; // expected-error{{invalid vector element type 's'}}
29 make3
<s
, 3>x
; // expected-note{{in instantiation of}}
32 template<typename T
, T Length
>
34 typedef T
__attribute__((ext_vector_type(Length
))) type
;
38 make4
<int, 4>::type x
;
43 template<unsigned Length
>
45 typedef int_ptr
__attribute__((ext_vector_type(Length
))) type
; // expected-error{{invalid vector element type}}
50 typedef int __attribute__((ext_vector_type(Length
))) type
;
59 y
.w
= -1; // expected-error{{vector component access exceeds type}}
63 template<typename T
> struct X0
;
65 template<typename T
, unsigned N
>
66 struct X0
<T
__attribute__((ext_vector_type(N
)))> {
67 static const unsigned value
= 0;
71 struct X0
<T
__attribute__((ext_vector_type(4)))> {
72 static const unsigned value
= 1;
76 struct X0
<float __attribute__((ext_vector_type(N
)))> {
77 static const unsigned value
= 2;
81 struct X0
<float __attribute__((ext_vector_type(4)))> {
82 static const unsigned value
= 3;
85 typedef int __attribute__((ext_vector_type(2))) int2
;
86 typedef int __attribute__((ext_vector_type(4))) int4
;
87 typedef float __attribute__((ext_vector_type(2))) float2
;
88 typedef float __attribute__((ext_vector_type(4))) float4
;
90 int array0
[X0
<int2
>::value
== 0? 1 : -1];
91 int array1
[X0
<int4
>::value
== 1? 1 : -1];
92 int array2
[X0
<float2
>::value
== 2? 1 : -1];
93 int array3
[X0
<float4
>::value
== 3? 1 : -1];