xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/warn-enum-compare.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -fsyntax-only -verify
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc enum Foo { FooA, FooB, FooC };
4*f4a2713aSLionel Sambuc enum Bar { BarD, BarE, BarF };
5*f4a2713aSLionel Sambuc enum { AnonAA = 42, AnonAB = 43 };
6*f4a2713aSLionel Sambuc enum { AnonBA = 44, AnonBB = 45 };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc namespace name1 {
9*f4a2713aSLionel Sambuc   enum Foo {F1, F2, F3};
10*f4a2713aSLionel Sambuc   enum Baz {B1, B2, B3};
11*f4a2713aSLionel Sambuc }
12*f4a2713aSLionel Sambuc 
13*f4a2713aSLionel Sambuc namespace name2 {
14*f4a2713aSLionel Sambuc   enum Baz {B1, B2, B3};
15*f4a2713aSLionel Sambuc }
16*f4a2713aSLionel Sambuc 
17*f4a2713aSLionel Sambuc using name1::Baz;
18*f4a2713aSLionel Sambuc using name1::B1;
19*f4a2713aSLionel Sambuc using name2::B2;
20*f4a2713aSLionel Sambuc typedef name1::Foo oneFoo;
21*f4a2713aSLionel Sambuc typedef name1::Foo twoFoo;
22*f4a2713aSLionel Sambuc Foo getFoo();
23*f4a2713aSLionel Sambuc Bar getBar();
24*f4a2713aSLionel Sambuc 
test()25*f4a2713aSLionel Sambuc void test () {
26*f4a2713aSLionel Sambuc   Foo x = FooA;
27*f4a2713aSLionel Sambuc   Bar y = BarD;
28*f4a2713aSLionel Sambuc   Baz z = name1::B3;
29*f4a2713aSLionel Sambuc   name1::Foo a;
30*f4a2713aSLionel Sambuc   oneFoo b;
31*f4a2713aSLionel Sambuc   twoFoo c;
32*f4a2713aSLionel Sambuc 
33*f4a2713aSLionel Sambuc   while (x == FooA);
34*f4a2713aSLionel Sambuc   while (y == BarD);
35*f4a2713aSLionel Sambuc   while (a == name1::F1);
36*f4a2713aSLionel Sambuc   while (z == name1::B2);
37*f4a2713aSLionel Sambuc   while (a == b);
38*f4a2713aSLionel Sambuc   while (a == c);
39*f4a2713aSLionel Sambuc   while (b == c);
40*f4a2713aSLionel Sambuc   while (B1 == name1::B2);
41*f4a2713aSLionel Sambuc   while (B2 == name2::B1);
42*f4a2713aSLionel Sambuc   while (x == AnonAA); // expected-warning {{comparison of constant 'AnonAA' (42) with expression of type 'Foo' is always false}}
43*f4a2713aSLionel Sambuc   while (AnonBB == y); // expected-warning {{comparison of constant 'AnonBB' (45) with expression of type 'Bar' is always false}}
44*f4a2713aSLionel Sambuc   while (AnonAA == AnonAB);
45*f4a2713aSLionel Sambuc   while (AnonAB == AnonBA);
46*f4a2713aSLionel Sambuc   while (AnonBB == AnonAA);
47*f4a2713aSLionel Sambuc 
48*f4a2713aSLionel Sambuc   while ((x) == FooA);
49*f4a2713aSLionel Sambuc   while ((y) == BarD);
50*f4a2713aSLionel Sambuc   while ((a) == name1::F1);
51*f4a2713aSLionel Sambuc   while (z == (name1::B2));
52*f4a2713aSLionel Sambuc   while (a == (b));
53*f4a2713aSLionel Sambuc   while (a == (c));
54*f4a2713aSLionel Sambuc   while ((b) == (c));
55*f4a2713aSLionel Sambuc   while ((B1) == (name1::B2));
56*f4a2713aSLionel Sambuc   while ((B2) == (name2::B1));
57*f4a2713aSLionel Sambuc 
58*f4a2713aSLionel Sambuc   while (((x)) == FooA);
59*f4a2713aSLionel Sambuc   while ((y) == (BarD));
60*f4a2713aSLionel Sambuc   while ((a) == (name1::F1));
61*f4a2713aSLionel Sambuc   while (z == (name1::B2));
62*f4a2713aSLionel Sambuc   while ((a) == ((((b)))));
63*f4a2713aSLionel Sambuc   while (((a)) == (c));
64*f4a2713aSLionel Sambuc   while ((b) == (((c))));
65*f4a2713aSLionel Sambuc   while ((((((B1))))) == (((name1::B2))));
66*f4a2713aSLionel Sambuc   while (B2 == ((((((name2::B1)))))));
67*f4a2713aSLionel Sambuc 
68*f4a2713aSLionel Sambuc   while (B1 == B2); // expected-warning  {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
69*f4a2713aSLionel Sambuc   while (name1::B2 == name2::B3); // expected-warning  {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
70*f4a2713aSLionel Sambuc   while (z == name2::B2); // expected-warning  {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
71*f4a2713aSLionel Sambuc 
72*f4a2713aSLionel Sambuc   while (((((B1)))) == B2); // expected-warning  {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
73*f4a2713aSLionel Sambuc   while (name1::B2 == (name2::B3)); // expected-warning  {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
74*f4a2713aSLionel Sambuc   while (z == ((((name2::B2))))); // expected-warning  {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
75*f4a2713aSLionel Sambuc 
76*f4a2713aSLionel Sambuc   while ((((B1))) == (((B2)))); // expected-warning  {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
77*f4a2713aSLionel Sambuc   while ((name1::B2) == (((name2::B3)))); // expected-warning  {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
78*f4a2713aSLionel Sambuc   while ((((z))) == (name2::B2)); // expected-warning  {{comparison of two values with different enumeration types ('name1::Baz' and 'name2::Baz')}}
79*f4a2713aSLionel Sambuc 
80*f4a2713aSLionel Sambuc   while (x == a); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'name1::Foo')}}
81*f4a2713aSLionel Sambuc   while (x == b); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'oneFoo' (aka 'name1::Foo'))}}
82*f4a2713aSLionel Sambuc   while (x == c); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'twoFoo' (aka 'name1::Foo'))}}
83*f4a2713aSLionel Sambuc 
84*f4a2713aSLionel Sambuc   while (x == y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
85*f4a2713aSLionel Sambuc   while (x != y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
86*f4a2713aSLionel Sambuc   while (x >= y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
87*f4a2713aSLionel Sambuc   while (x <= y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
88*f4a2713aSLionel Sambuc   while (x > y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
89*f4a2713aSLionel Sambuc   while (x < y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
90*f4a2713aSLionel Sambuc 
91*f4a2713aSLionel Sambuc   while (FooB == y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
92*f4a2713aSLionel Sambuc   while (FooB != y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
93*f4a2713aSLionel Sambuc   while (FooB >= y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
94*f4a2713aSLionel Sambuc   while (FooB <= y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
95*f4a2713aSLionel Sambuc   while (FooB > y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
96*f4a2713aSLionel Sambuc   while (FooB < y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
97*f4a2713aSLionel Sambuc 
98*f4a2713aSLionel Sambuc   while (FooB == BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
99*f4a2713aSLionel Sambuc   while (FooB != BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
100*f4a2713aSLionel Sambuc   while (FooB >= BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
101*f4a2713aSLionel Sambuc   while (FooB <= BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
102*f4a2713aSLionel Sambuc   while (FooB > BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
103*f4a2713aSLionel Sambuc   while (FooB < BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
104*f4a2713aSLionel Sambuc 
105*f4a2713aSLionel Sambuc   while (x == BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
106*f4a2713aSLionel Sambuc   while (x != BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
107*f4a2713aSLionel Sambuc   while (x >= BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
108*f4a2713aSLionel Sambuc   while (x <= BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
109*f4a2713aSLionel Sambuc   while (x > BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
110*f4a2713aSLionel Sambuc   while (x < BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
111*f4a2713aSLionel Sambuc 
112*f4a2713aSLionel Sambuc   while (getFoo() == y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
113*f4a2713aSLionel Sambuc   while (getFoo() != y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
114*f4a2713aSLionel Sambuc   while (getFoo() >= y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
115*f4a2713aSLionel Sambuc   while (getFoo() <= y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
116*f4a2713aSLionel Sambuc   while (getFoo() > y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
117*f4a2713aSLionel Sambuc   while (getFoo() < y); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
118*f4a2713aSLionel Sambuc 
119*f4a2713aSLionel Sambuc   while (getFoo() == BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
120*f4a2713aSLionel Sambuc   while (getFoo() != BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
121*f4a2713aSLionel Sambuc   while (getFoo() >= BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
122*f4a2713aSLionel Sambuc   while (getFoo() <= BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
123*f4a2713aSLionel Sambuc   while (getFoo() > BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
124*f4a2713aSLionel Sambuc   while (getFoo() < BarD); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
125*f4a2713aSLionel Sambuc 
126*f4a2713aSLionel Sambuc   while (getFoo() == getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
127*f4a2713aSLionel Sambuc   while (getFoo() != getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
128*f4a2713aSLionel Sambuc   while (getFoo() >= getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
129*f4a2713aSLionel Sambuc   while (getFoo() <= getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
130*f4a2713aSLionel Sambuc   while (getFoo() > getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
131*f4a2713aSLionel Sambuc   while (getFoo() < getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
132*f4a2713aSLionel Sambuc 
133*f4a2713aSLionel Sambuc   while (FooB == getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
134*f4a2713aSLionel Sambuc   while (FooB != getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
135*f4a2713aSLionel Sambuc   while (FooB >= getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
136*f4a2713aSLionel Sambuc   while (FooB <= getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
137*f4a2713aSLionel Sambuc   while (FooB > getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
138*f4a2713aSLionel Sambuc   while (FooB < getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
139*f4a2713aSLionel Sambuc 
140*f4a2713aSLionel Sambuc   while (x == getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
141*f4a2713aSLionel Sambuc   while (x != getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
142*f4a2713aSLionel Sambuc   while (x >= getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
143*f4a2713aSLionel Sambuc   while (x <= getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
144*f4a2713aSLionel Sambuc   while (x > getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
145*f4a2713aSLionel Sambuc   while (x < getBar()); // expected-warning  {{comparison of two values with different enumeration types ('Foo' and 'Bar')}}
146*f4a2713aSLionel Sambuc 
147*f4a2713aSLionel Sambuc 
148*f4a2713aSLionel Sambuc 
149*f4a2713aSLionel Sambuc   while (y == x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
150*f4a2713aSLionel Sambuc   while (y != x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
151*f4a2713aSLionel Sambuc   while (y >= x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
152*f4a2713aSLionel Sambuc   while (y <= x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
153*f4a2713aSLionel Sambuc   while (y > x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
154*f4a2713aSLionel Sambuc   while (y < x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
155*f4a2713aSLionel Sambuc 
156*f4a2713aSLionel Sambuc   while (y == FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
157*f4a2713aSLionel Sambuc   while (y != FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
158*f4a2713aSLionel Sambuc   while (y >= FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
159*f4a2713aSLionel Sambuc   while (y <= FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
160*f4a2713aSLionel Sambuc   while (y > FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
161*f4a2713aSLionel Sambuc   while (y < FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
162*f4a2713aSLionel Sambuc 
163*f4a2713aSLionel Sambuc   while (BarD == FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
164*f4a2713aSLionel Sambuc   while (BarD != FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
165*f4a2713aSLionel Sambuc   while (BarD >= FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
166*f4a2713aSLionel Sambuc   while (BarD <= FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
167*f4a2713aSLionel Sambuc   while (BarD > FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
168*f4a2713aSLionel Sambuc   while (BarD <FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
169*f4a2713aSLionel Sambuc 
170*f4a2713aSLionel Sambuc   while (BarD == x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
171*f4a2713aSLionel Sambuc   while (BarD != x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
172*f4a2713aSLionel Sambuc   while (BarD >= x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
173*f4a2713aSLionel Sambuc   while (BarD <= x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
174*f4a2713aSLionel Sambuc   while (BarD < x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
175*f4a2713aSLionel Sambuc   while (BarD > x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
176*f4a2713aSLionel Sambuc 
177*f4a2713aSLionel Sambuc   while (y == getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
178*f4a2713aSLionel Sambuc   while (y != getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
179*f4a2713aSLionel Sambuc   while (y >= getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
180*f4a2713aSLionel Sambuc   while (y <= getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
181*f4a2713aSLionel Sambuc   while (y > getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
182*f4a2713aSLionel Sambuc   while (y < getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
183*f4a2713aSLionel Sambuc 
184*f4a2713aSLionel Sambuc   while (BarD == getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
185*f4a2713aSLionel Sambuc   while (BarD != getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
186*f4a2713aSLionel Sambuc   while (BarD >= getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
187*f4a2713aSLionel Sambuc   while (BarD <= getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
188*f4a2713aSLionel Sambuc   while (BarD > getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
189*f4a2713aSLionel Sambuc   while (BarD < getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
190*f4a2713aSLionel Sambuc 
191*f4a2713aSLionel Sambuc   while (getBar() == getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
192*f4a2713aSLionel Sambuc   while (getBar() != getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
193*f4a2713aSLionel Sambuc   while (getBar() >= getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
194*f4a2713aSLionel Sambuc   while (getBar() <= getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
195*f4a2713aSLionel Sambuc   while (getBar() > getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
196*f4a2713aSLionel Sambuc   while (getBar() < getFoo()); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
197*f4a2713aSLionel Sambuc 
198*f4a2713aSLionel Sambuc   while (getBar() == FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
199*f4a2713aSLionel Sambuc   while (getBar() != FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
200*f4a2713aSLionel Sambuc   while (getBar() >= FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
201*f4a2713aSLionel Sambuc   while (getBar() <= FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
202*f4a2713aSLionel Sambuc   while (getBar() > FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
203*f4a2713aSLionel Sambuc   while (getBar() < FooB); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
204*f4a2713aSLionel Sambuc 
205*f4a2713aSLionel Sambuc   while (getBar() == x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
206*f4a2713aSLionel Sambuc   while (getBar() != x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
207*f4a2713aSLionel Sambuc   while (getBar() >= x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
208*f4a2713aSLionel Sambuc   while (getBar() <= x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
209*f4a2713aSLionel Sambuc   while (getBar() > x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
210*f4a2713aSLionel Sambuc   while (getBar() < x); // expected-warning  {{comparison of two values with different enumeration types ('Bar' and 'Foo')}}
211*f4a2713aSLionel Sambuc 
212*f4a2713aSLionel Sambuc }
213