1// RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-apple-darwin9
2
3// rdar://6097662
4typedef int (*T)[2];
5restrict T x;
6
7typedef int *S[2];
8restrict S y; // expected-error {{restrict requires a pointer or reference ('S' (aka 'int *[2]') is invalid)}}
9
10
11
12// int128_t is available.
13int a() {
14  __int128_t s;
15  __uint128_t t;
16}
17// but not a keyword
18int b() {
19  int __int128_t;
20  int __uint128_t;
21}
22// __int128 is a keyword
23int c() {
24  __int128 i;
25  unsigned __int128 j;
26  long unsigned __int128 k; // expected-error {{'long __int128' is invalid}}
27  int __int128; // expected-error {{cannot combine with previous}} expected-warning {{does not declare anything}}
28}
29// __int128_t is __int128; __uint128_t is unsigned __int128.
30typedef __int128 check_int_128; // expected-note {{here}}
31typedef __int128_t check_int_128; // expected-note {{here}} expected-warning {{redefinition}}
32typedef int check_int_128; // expected-error {{different types ('int' vs '__int128_t' (aka '__int128'))}}
33
34typedef unsigned __int128 check_uint_128; // expected-note {{here}}
35typedef __uint128_t check_uint_128; // expected-note {{here}} expected-warning {{redefinition}}
36typedef int check_uint_128; // expected-error {{different types ('int' vs '__uint128_t' (aka 'unsigned __int128'))}}
37
38// Array type merging should convert array size to whatever matches the target
39// pointer size.
40// rdar://6880874
41extern int i[1LL];
42int i[(short)1];
43
44enum e { e_1 };
45extern int j[sizeof(enum e)];  // expected-note {{previous definition}}
46int j[42];   // expected-error {{redefinition of 'j' with a different type: 'int [42]' vs 'int [4]'}}
47
48// rdar://6880104
49_Decimal32 x;  // expected-error {{GNU decimal type extension not supported}}
50
51
52// rdar://6880951
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/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.
64void test2(int i) {
65  char c = (char __attribute__((may_alias))) i;
66}
67
68// vector size too large
69int __attribute__ ((vector_size(8192))) x1; // expected-error {{vector size too large}}
70typedef int __attribute__ ((ext_vector_type(8192))) x2; // expected-error {{vector size too large}}
71
72// no support for vector enum type
73enum { e_2 } x3 __attribute__((vector_size(64))); // expected-error {{invalid vector element type}}
74
75int x4 __attribute__((ext_vector_type(64)));  // expected-error {{'ext_vector_type' attribute only applies to types}}
76
77// rdar://16492792
78typedef __attribute__ ((ext_vector_type(32),__aligned__(32))) unsigned char uchar32;
79
80void convert() {
81    uchar32 r = 0;
82    r.s[ 1234 ] = 1; // expected-error {{illegal vector component name 's'}}
83}
84