1 // RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=x86_64-apple-darwin9 2 // RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=mips64-linux-gnu 3 // RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=x86_64-unknown-linux 4 // RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=x86_64-unknown-linux-gnux32 5 // RUN: %clang_cc1 %s -fblocks -pedantic -pedantic -verify -triple=arm64_32-apple-ios7.0 6 // RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=powerpc64-ibm-aix-xcoff 7 8 typedef int (*T)[2]; 9 restrict T x; 10 11 typedef int *S[2]; 12 restrict S y; // expected-error {{restrict requires a pointer or reference ('S' (aka 'int *[2]') is invalid)}} 13 14 15 16 // int128_t is available. a(void)17int a(void) { 18 __int128_t s; 19 __uint128_t t; 20 } 21 // but not a keyword b(void)22int b(void) { 23 int __int128_t; 24 int __uint128_t; 25 } 26 // __int128 is a keyword c(void)27int c(void) { 28 __int128 i; 29 unsigned __int128 j; 30 long unsigned __int128 k; // expected-error {{'long __int128' is invalid}} 31 int __int128; // expected-error {{cannot combine with previous}} expected-warning {{does not declare anything}} 32 } 33 // __int128_t is __int128; __uint128_t is unsigned __int128. 34 typedef __int128 check_int_128; 35 typedef __int128_t check_int_128; // expected-note {{here}} 36 typedef int check_int_128; // expected-error {{different types ('int' vs '__int128_t' (aka '__int128'))}} 37 38 typedef unsigned __int128 check_uint_128; 39 typedef __uint128_t check_uint_128; // expected-note {{here}} 40 typedef int check_uint_128; // expected-error {{different types ('int' vs '__uint128_t' (aka 'unsigned __int128'))}} 41 42 // Array type merging should convert array size to whatever matches the target 43 // pointer size. 44 extern int i[1LL]; 45 int i[(short)1]; 46 47 enum e { e_1 }; 48 extern int j[sizeof(enum e)]; // expected-note {{previous declaration}} 49 int j[42]; // expected-error {{redefinition of 'j' with a different type: 'int[42]' vs 'int[4]'}} 50 51 _Decimal32 x; // expected-error {{GNU decimal type extension not supported}} 52 53 int __attribute__ ((vector_size (8), vector_size (8))) v; // expected-error {{invalid vector element type}} 54 test(int i)55void test(int i) { 56 char c = (char __attribute__((aligned(8)))) i; // expected-warning {{'aligned' attribute ignored when parsing type}} 57 } 58 59 // http://llvm.org/PR11082 60 // 61 // FIXME: This may or may not be the correct approach (no warning or error), 62 // but large amounts of Linux and FreeBSD code need this attribute to not be 63 // a hard error in order to work correctly. test2(int i)64void test2(int i) { 65 char c = (char __attribute__((may_alias))) i; 66 } 67 68 // vector size 69 int __attribute__((vector_size(123456))) v1; 70 int __attribute__((vector_size(0x1000000000))) v2; // expected-error {{vector size too large}} 71 int __attribute__((vector_size((__int128_t)1 << 100))) v3; // expected-error {{vector size too large}} 72 int __attribute__((vector_size(0))) v4; // expected-error {{zero vector size}} 73 typedef int __attribute__((ext_vector_type(123456))) e1; 74 typedef int __attribute__((ext_vector_type(0x100000000))) e2; // expected-error {{vector size too large}} 75 typedef int __attribute__((vector_size((__int128_t)1 << 100))) e3; // expected-error {{vector size too large}} 76 typedef int __attribute__((ext_vector_type(0))) e4; // expected-error {{zero vector size}} 77 78 // no support for vector enum type 79 enum { e_2 } x3 __attribute__((vector_size(64))); // expected-error {{invalid vector element type}} 80 81 int x4 __attribute__((ext_vector_type(64))); // expected-error {{'ext_vector_type' attribute only applies to typedefs}} 82 83 typedef __attribute__ ((ext_vector_type(32),__aligned__(32))) unsigned char uchar32; 84 convert(void)85void convert(void) { 86 uchar32 r = 0; 87 r.s[ 1234 ] = 1; // expected-error {{illegal vector component name 's'}} 88 } 89 90 int &*_Atomic null_type_0; // expected-error {{expected identifier or '('}} 91 int &*__restrict__ null_type_1; // expected-error {{expected identifier or '('}} 92 int ^_Atomic null_type_2; // expected-error {{block pointer to non-function type is invalid}} 93