93 lines · c
1// RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=x86_64-apple-darwin92// RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=mips64-linux-gnu3// RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=x86_64-unknown-linux4// RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=x86_64-unknown-linux-gnux325// RUN: %clang_cc1 %s -fblocks -pedantic -pedantic -verify -triple=arm64_32-apple-ios7.06// RUN: %clang_cc1 %s -fblocks -pedantic -verify -triple=powerpc64-ibm-aix-xcoff7 8typedef int (*T)[2];9restrict T x;10 11typedef int *S[2];12restrict S y; // expected-warning {{'restrict' qualifier on an array of pointers is a C23 extension}}13 14// int128_t is available.15void a(void) {16 __int128_t s;17 __uint128_t t;18}19 20// but not a keyword21void b(void) {22 int __int128_t;23 int __uint128_t;24}25 26// __int128 is a keyword27int 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.34typedef __int128 check_int_128;35typedef __int128_t check_int_128; // expected-note {{here}}36typedef int check_int_128; // expected-error {{different types ('int' vs '__int128_t' (aka '__int128'))}}37 38typedef unsigned __int128 check_uint_128;39typedef __uint128_t check_uint_128; // expected-note {{here}}40typedef 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 target43// pointer size.44extern int i[1LL];45int i[(short)1];46 47enum e { e_1 };48extern int j[sizeof(enum e)]; // expected-note {{previous declaration}}49int 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 53int __attribute__ ((vector_size (8), vector_size (8))) v; // expected-error {{invalid vector element type}}54 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/PR1108260//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 be63// a hard error in order to work correctly.64void test2(int i) {65 char c = (char __attribute__((may_alias))) i;66}67 68// vector size69int __attribute__((vector_size(123456))) v1;70int __attribute__((vector_size(0x1000000000))) v2; // expected-error {{vector size too large}}71int __attribute__((vector_size((__int128_t)1 << 100))) v3; // expected-error {{vector size too large}}72int __attribute__((vector_size(0))) v4; // expected-error {{zero vector size}}73typedef int __attribute__((ext_vector_type(123456))) e1;74typedef int __attribute__((ext_vector_type(0x100000000))) e2; // expected-error {{vector size too large}}75typedef int __attribute__((vector_size((__int128_t)1 << 100))) e3; // expected-error {{vector size too large}}76typedef int __attribute__((ext_vector_type(0))) e4; // expected-error {{zero vector size}}77 78// no support for vector enum type79enum { e_2 } x3 __attribute__((vector_size(64))); // expected-error {{invalid vector element type}}80 81int x4 __attribute__((ext_vector_type(64)));82 83typedef __attribute__ ((ext_vector_type(32),__aligned__(32))) unsigned char uchar32;84 85void convert(void) {86 uchar32 r = 0;87 r.s[ 1234 ] = 1; // expected-error {{illegal vector component name 's'}}88}89 90int &*_Atomic null_type_0; // expected-error {{expected identifier or '('}}91int &*__restrict__ null_type_1; // expected-error {{expected identifier or '('}}92int ^_Atomic null_type_2; // expected-error {{block pointer to non-function type is invalid}}93