Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc %s -fsyntax-only -verify |
Nate Begeman | d47d4f5 | 2008-01-25 05:34:48 +0000 | [diff] [blame] | 2 | |
Douglas Gregor | 7c53ca6 | 2009-02-18 22:23:55 +0000 | [diff] [blame] | 3 | //typedef __attribute__(( ext_vector_type(4) )) float float4; |
| 4 | typedef float float4 __attribute__((vector_size(16))); |
Nate Begeman | d47d4f5 | 2008-01-25 05:34:48 +0000 | [diff] [blame] | 5 | |
| 6 | float4 foo = (float4){ 1.0, 2.0, 3.0, 4.0 }; |
Douglas Gregor | 4c67834 | 2009-01-28 21:54:33 +0000 | [diff] [blame] | 7 | |
Douglas Gregor | 7c53ca6 | 2009-02-18 22:23:55 +0000 | [diff] [blame] | 8 | float4 foo2 = (float4){ 1.0, 2.0, 3.0, 4.0 , 5.0 }; // expected-warning{{excess elements in vector initializer}} |
| 9 | |
Douglas Gregor | 4c67834 | 2009-01-28 21:54:33 +0000 | [diff] [blame] | 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]; |
| 12 | |
| 13 | float4 array2[2] = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, |
Douglas Gregor | 7c53ca6 | 2009-02-18 22:23:55 +0000 | [diff] [blame] | 14 | 9.0 }; // expected-warning {{excess elements in array initializer}} |
Douglas Gregor | 4c67834 | 2009-01-28 21:54:33 +0000 | [diff] [blame] | 15 | |
| 16 | float4 array3[2] = { {1.0, 2.0, 3.0}, 5.0, 6.0, 7.0, 8.0, |
Douglas Gregor | 7c53ca6 | 2009-02-18 22:23:55 +0000 | [diff] [blame] | 17 | 9.0 }; // expected-warning {{excess elements in array initializer}} |
Chris Lattner | 2db15bd | 2009-05-13 04:00:12 +0000 | [diff] [blame^] | 18 | |
| 19 | |
| 20 | // rdar://6881069 |
| 21 | __attribute__((vector_size(16))) // expected-error {{unsupported type 'float (void)' for vector_size attribute, please use on typedef}} |
| 22 | float f1(void) { |
| 23 | } |