1 // RUN: %clang_cc1 -triple %itanium_abi_triple -verify -fsyntax-only -Wsign-conversion %s
3 // NOTE: When a 'enumeral mismatch' warning is implemented then expect several
4 // of the following cases to be impacted.
6 // namespace for unnamed enums tests
11 template <typename T
> struct Foo
{
18 void doit_unnamed( int i
) {
25 int c1
= 1 ? i
: Foo
<bool>::C
;
26 int c2
= 1 ? Foo
<bool>::C
: i
;
28 int d1a
= 1 ? i
: Foo
<bool>::D
; // expected-warning {{test1::Foo<bool>::(unnamed enum at }}
29 int d1b
= 1 ? i
: Foo
<bool>::D
; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}}
30 int d2a
= 1 ? Foo
<bool>::D
: i
; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::(unnamed enum at }}
31 int d2b
= 1 ? Foo
<bool>::D
: i
; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}}
32 int d3a
= 1 ? B
: Foo
<bool>::D
; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::(unnamed enum at }}
33 int d3b
= 1 ? B
: Foo
<bool>::D
; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}}
34 int d4a
= 1 ? Foo
<bool>::D
: B
; // expected-warning {{operand of ? changes signedness: 'test1::Foo<bool>::(unnamed enum at }}
35 int d4b
= 1 ? Foo
<bool>::D
: B
; // expected-warning {{warn-sign-conversion.cpp:13:5)' to 'int'}}
37 int e1a
= 1 ? i
: E
; // expected-warning {{operand of ? changes signedness: 'test1::(unnamed enum at }}
38 int e1b
= 1 ? i
: E
; // expected-warning {{warn-sign-conversion.cpp:16:3)' to 'int'}}
39 int e2a
= 1 ? E
: i
; // expected-warning {{operand of ? changes signedness: 'test1::(unnamed enum at }}
40 int e2b
= 1 ? E
: i
; // expected-warning {{warn-sign-conversion.cpp:16:3)' to 'int'}}
41 int e3a
= 1 ? E
: B
; // expected-warning {{operand of ? changes signedness: 'test1::(unnamed enum at }}
42 int e3b
= 1 ? E
: B
; // expected-warning {{warn-sign-conversion.cpp:16:3)' to 'int'}}
43 int e4a
= 1 ? B
: E
; // expected-warning {{operand of ? changes signedness: 'test1::(unnamed enum at }}
44 int e4b
= 1 ? B
: E
; // expected-warning {{warn-sign-conversion.cpp:16:3)' to 'int'}}
48 // namespace for named enums tests
51 enum Named2
{ B
= -1 };
53 template <typename T
> struct Foo
{
55 enum Named4
{ D
= ~0U };
58 enum Named5
{ E
= ~0U };
60 void doit_unnamed( int i
) {
67 int c1
= 1 ? i
: Foo
<bool>::C
;
68 int c2
= 1 ? Foo
<bool>::C
: i
;
70 int d1
= 1 ? i
: Foo
<bool>::D
; // expected-warning {{operand of ? changes signedness: 'test2::Foo<bool>::Named4' to 'int'}}
71 int d2
= 1 ? Foo
<bool>::D
: i
; // expected-warning {{operand of ? changes signedness: 'test2::Foo<bool>::Named4' to 'int'}}
72 int d3
= 1 ? B
: Foo
<bool>::D
; // expected-warning {{operand of ? changes signedness: 'test2::Foo<bool>::Named4' to 'int'}}
73 int d4
= 1 ? Foo
<bool>::D
: B
; // expected-warning {{operand of ? changes signedness: 'test2::Foo<bool>::Named4' to 'int'}}
75 int e1
= 1 ? i
: E
; // expected-warning {{operand of ? changes signedness: 'test2::Named5' to 'int'}}
76 int e2
= 1 ? E
: i
; // expected-warning {{operand of ? changes signedness: 'test2::Named5' to 'int'}}
77 int e3
= 1 ? E
: B
; // expected-warning {{operand of ? changes signedness: 'test2::Named5' to 'int'}}
78 int e4
= 1 ? B
: E
; // expected-warning {{operand of ? changes signedness: 'test2::Named5' to 'int'}}