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