blob: d0d9cf053ede39dc99621100ba10c0308e4fad2b [file] [log] [blame]
Daniel Dunbarffd408a2009-03-24 02:24:46 +00001// RUN: clang-cc %s -fsyntax-only -verify
Nate Begemanc4e28e42008-01-25 05:34:48 +00002
Douglas Gregorc25bf6d2009-02-18 22:23:55 +00003//typedef __attribute__(( ext_vector_type(4) )) float float4;
4typedef float float4 __attribute__((vector_size(16)));
Nate Begemanc4e28e42008-01-25 05:34:48 +00005
6float4 foo = (float4){ 1.0, 2.0, 3.0, 4.0 };
Douglas Gregorf603b472009-01-28 21:54:33 +00007
Douglas Gregorc25bf6d2009-02-18 22:23:55 +00008float4 foo2 = (float4){ 1.0, 2.0, 3.0, 4.0 , 5.0 }; // expected-warning{{excess elements in vector initializer}}
9
Douglas Gregorf603b472009-01-28 21:54:33 +000010float4 array[] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0};
11int array_sizecheck[(sizeof(array) / sizeof(float4)) == 3? 1 : -1];
12
13float4 array2[2] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0,
Douglas Gregorc25bf6d2009-02-18 22:23:55 +000014 9.0 }; // expected-warning {{excess elements in array initializer}}
Douglas Gregorf603b472009-01-28 21:54:33 +000015
16float4 array3[2] = { {1.0, 2.0, 3.0}, 5.0, 6.0, 7.0, 8.0,
Douglas Gregorc25bf6d2009-02-18 22:23:55 +000017 9.0 }; // expected-warning {{excess elements in array initializer}}