Allow resolving headers from a PCH even after headers+PCH were moved to another path.
[clang.git] / test / Sema / vector-init.c
blob5be040ae6c11d4ce3fa95830bfee966d31bca170
1 // RUN: %clang_cc1 %s -fsyntax-only -verify
3 //typedef __attribute__(( ext_vector_type(4) )) float float4;
4 typedef float float4 __attribute__((vector_size(16)));
6 float4 foo = (float4){ 1.0, 2.0, 3.0, 4.0 };
8 float4 foo2 = (float4){ 1.0, 2.0, 3.0, 4.0 , 5.0 }; // expected-warning{{excess elements in vector initializer}}
10 float4 array[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0};
11 int array_sizecheck[(sizeof(array) / sizeof(float4)) == 3 ? 1 : -1];
13 float4 array2[2] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,
14 9.0 }; // expected-warning {{excess elements in array initializer}}
16 float4 array3[2] = { {1.0, 2.0, 3.0}, 5.0, 6.0, 7.0, 8.0,
17 9.0 }; // expected-warning {{excess elements in array initializer}}
19 // PR5650
20 __attribute__((vector_size(16))) float f1(void) {
21 __attribute__((vector_size(16))) float vec = {0.0f, 0.0f, 0.0f};
22 return(vec);
25 __attribute__((vector_size(16))) float f2(
26 __attribute__((vector_size(16))) float a1) {
27 return(a1);
32 // PR5265
33 typedef float __attribute__((ext_vector_type (3))) float3;
34 int test2[sizeof(float3) == sizeof(float4) ? 1 : -1];
36 // rdar://problem/8345836
37 typedef long long __attribute__((vector_size(16))) longlong2;
38 typedef short __attribute__((vector_size(16))) short8;
39 typedef short __attribute__((vector_size(8))) short4;
40 void test3() {
41 extern short8 test3_helper(void);
42 longlong2 arr1[2] = { test3_helper(), test3_helper() };
43 short4 arr2[2] = { test3_helper(), test3_helper() }; // expected-error 2 {{initializing 'short4' with an expression of incompatible type 'short8'}}