xref: /llvm-project/clang/test/Sema/types.c (revision 08d0491006c28c92e18de9e108ad09e6333d4fed)
1 // RUN: %clang_cc1 %s -pedantic -verify -triple=x86_64-apple-darwin9
2 
3 // rdar://6097662
4 typedef int (*T)[2];
5 restrict T x;
6 
7 typedef int *S[2];
8 restrict S y; // expected-error {{restrict requires a pointer or reference ('S' (aka 'int *[2]') is invalid)}}
9 
10 
11 
12 // int128_t is available.
13 int a() {
14   __int128_t s;
15   __uint128_t t;
16 }
17 // but not a keyword
18 int b() {
19   int __int128_t;
20   int __uint128_t;
21 }
22 
23 
24 // Array type merging should convert array size to whatever matches the target
25 // pointer size.
26 // rdar://6880874
27 extern int i[1LL];
28 int i[(short)1];
29 
30 enum e { e_1 };
31 extern int j[sizeof(enum e)];  // expected-note {{previous definition}}
32 int j[42];   // expected-error {{redefinition of 'j' with a different type}}
33 
34 // rdar://6880104
35 _Decimal32 x;  // expected-error {{GNU decimal type extension not supported}}
36 
37 
38 // rdar://6880951
39 int __attribute__ ((vector_size (8), vector_size (8))) v;  // expected-error {{invalid vector element type}}
40 
41 void test(int i) {
42   char c = (char __attribute__((align(8)))) i; // expected-error {{'align' attribute ignored when parsing type}}
43 }
44 
45 // http://llvm.org/PR11082
46 //
47 // FIXME: This may or may not be the correct approach (no warning or error),
48 // but large amounts of Linux and FreeBSD code need this attribute to not be
49 // a hard error in order to work correctly.
50 void test2(int i) {
51   char c = (char __attribute__((may_alias))) i;
52 }
53