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