Anders Carlsson | 0de51bc | 2009-09-16 19:19:43 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | typedef int __v2si __attribute__((__vector_size__(8))); |
| 3 | typedef short __v4hi __attribute__((__vector_size__(8))); |
| 4 | typedef short __v8hi __attribute__((__vector_size__(16))); |
| 5 | |
| 6 | struct S { }; |
| 7 | |
| 8 | void f() { |
| 9 | __v2si v2si; |
| 10 | __v4hi v4hi; |
| 11 | __v8hi v8hi; |
| 12 | unsigned long long ll; |
| 13 | unsigned char c; |
| 14 | S s; |
| 15 | |
| 16 | (void)reinterpret_cast<__v2si>(v4hi); |
| 17 | (void)(__v2si)v4hi; |
| 18 | (void)reinterpret_cast<__v4hi>(v2si); |
| 19 | (void)(__v4hi)v2si; |
| 20 | (void)reinterpret_cast<unsigned long long>(v2si); |
| 21 | (void)(unsigned long long)v2si; |
| 22 | (void)reinterpret_cast<__v2si>(ll); |
| 23 | (void)(__v2si)(ll); |
| 24 | |
| 25 | (void)reinterpret_cast<S>(v2si); // expected-error {{reinterpret_cast from '__v2si' to 'struct S' is not allowed}} |
| 26 | (void)(S)v2si; // expected-error {{C-style cast from '__v2si' to 'struct S' is not allowed}} |
| 27 | (void)reinterpret_cast<__v2si>(s); // expected-error {{reinterpret_cast from 'struct S' to '__v2si' is not allowed}} |
| 28 | (void)(__v2si)s; // expected-error {{C-style cast from 'struct S' to '__v2si' is not allowed}} |
| 29 | |
| 30 | (void)reinterpret_cast<unsigned char>(v2si); // expected-error {{reinterpret_cast from vector '__v2si' to scalar 'unsigned char' of different size}} |
| 31 | (void)(unsigned char)v2si; // expected-error {{C-style cast from vector '__v2si' to scalar 'unsigned char' of different size}} |
| 32 | (void)reinterpret_cast<__v2si>(c); // expected-error {{reinterpret_cast from scalar 'unsigned char' to vector '__v2si' of different size}} |
| 33 | |
| 34 | (void)reinterpret_cast<__v8hi>(v4hi); // expected-error {{reinterpret_cast from vector '__v4hi' to vector '__v8hi' of different size}} |
| 35 | (void)(__v8hi)v4hi; // expected-error {{C-style cast from vector '__v4hi' to vector '__v8hi' of different size}} |
| 36 | (void)reinterpret_cast<__v4hi>(v8hi); // expected-error {{reinterpret_cast from vector '__v8hi' to vector '__v4hi' of different size}} |
| 37 | (void)(__v4hi)v8hi; // expected-error {{C-style cast from vector '__v8hi' to vector '__v4hi' of different size}} |
| 38 | } |
| 39 | |
| 40 | |