[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / Sema / enum-sign-conversion.c
blobecc7de2da857a86d30e34779eac73eda19379d63
1 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -Wsign-conversion -verify=unsigned,both %s
2 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -Wconversion -verify=unsigned,both %s
3 // RUN: %clang_cc1 -triple=x86_64-pc-win32 -fsyntax-only -verify -Wsign-conversion -verify=win32,both %s
5 // PR35200
6 enum X { A,B,C};
7 int f(enum X x) {
8 return x; // unsigned-warning {{implicit conversion changes signedness: 'enum X' to 'int'}}
11 enum SE1 { N1 = -1 }; // Always a signed underlying type.
12 enum E1 { P1 }; // Unsigned underlying type except on Windows.
14 // ensure no regression with enum to sign (related to enum-enum-conversion.c)
15 int f1(enum E1 E) {
16 return E; // unsigned-warning {{implicit conversion changes signedness: 'enum E1' to 'int'}}
19 enum E1 f2(int E) {
20 return E; // unsigned-warning {{implicit conversion changes signedness: 'int' to 'enum E1'}}
23 int f3(enum SE1 E) {
24 return E; // shouldn't warn
27 enum SE1 f4(int E) {
28 return E; // shouldn't warn
31 unsigned f5(enum E1 E) {
32 return E; // win32-warning {{implicit conversion changes signedness: 'enum E1' to 'unsigned int'}}
35 enum E1 f6(unsigned E) {
36 return E; // win32-warning {{implicit conversion changes signedness: 'unsigned int' to 'enum E1'}}
39 unsigned f7(enum SE1 E) {
40 return E; // both-warning {{implicit conversion changes signedness: 'enum SE1' to 'unsigned int'}}
43 enum SE1 f8(unsigned E) {
44 return E; // both-warning {{implicit conversion changes signedness: 'unsigned int' to 'enum SE1'}}