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
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)
16 return E
; // unsigned-warning {{implicit conversion changes signedness: 'enum E1' to 'int'}}
20 return E
; // unsigned-warning {{implicit conversion changes signedness: 'int' to 'enum E1'}}
24 return E
; // shouldn't warn
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'}}