1 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -DUNSIGNED -verify %s
2 // RUN: %clang_cc1 -triple=x86_64-pc-win32 -fsyntax-only -DSIGNED -verify %s
3 // RUN: %clang_cc1 -triple=x86_64-pc-linux-gnu -fsyntax-only -DUNSIGNED -DSILENCE -Wno-tautological-constant-out-of-range-compare -verify %s
4 // RUN: %clang_cc1 -triple=x86_64-pc-win32 -fsyntax-only -DSIGNED -DSILENCE -Wno-tautological-constant-out-of-range-compare -verify %s
11 // expected-no-diagnostics
16 if (a
< 4294967296) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
18 if (4294967296 >= a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
20 if (a
> 4294967296) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
22 if (4294967296 <= a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
24 if (a
<= 4294967296) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
26 if (4294967296 > a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
28 if (a
>= 4294967296) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
30 if (4294967296 < a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
32 if (a
== 4294967296) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
34 if (4294967296 != a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
36 if (a
!= 4294967296) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
38 if (4294967296 == a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
41 if (a
< 4294967296U) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
43 if (4294967296U >= a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
45 if (a
> 4294967296U) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
47 if (4294967296U <= a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
49 if (a
<= 4294967296U) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
51 if (4294967296U > a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
53 if (a
>= 4294967296U) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
55 if (4294967296U < a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
57 if (a
== 4294967296U) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
59 if (4294967296U != a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
61 if (a
!= 4294967296U) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always true}}
63 if (4294967296U == a
) // expected-warning {{comparison of constant 4294967296 with expression of type 'enum A' is always false}}
103 if (a
>= 4294967296U)
107 if (a
== 4294967296U)
109 if (4294967296U != a
)
111 if (a
!= 4294967296U)
113 if (4294967296U == a
)
116 #elif defined(SIGNED)
118 if (a
< -2147483649) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always false}}
120 if (-2147483649 >= a
) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always false}}
122 if (a
> -2147483649) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always true}}
124 if (-2147483649 <= a
) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always true}}
126 if (a
<= -2147483649) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always false}}
128 if (-2147483649 > a
) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always false}}
130 if (a
>= -2147483649) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always true}}
132 if (-2147483649 < a
) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always true}}
134 if (a
== -2147483649) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always false}}
136 if (-2147483649 != a
) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always true}}
138 if (a
!= -2147483649) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always true}}
140 if (-2147483649 == a
) // expected-warning {{comparison of constant -2147483649 with expression of type 'enum A' is always false}}
143 if (a
< 2147483648) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always true}}
145 if (2147483648 >= a
) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always true}}
147 if (a
> 2147483648) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always false}}
149 if (2147483648 <= a
) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always false}}
151 if (a
<= 2147483648) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always true}}
153 if (2147483648 > a
) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always true}}
155 if (a
>= 2147483648) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always false}}
157 if (2147483648 < a
) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always false}}
159 if (a
== 2147483648) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always false}}
161 if (2147483648 != a
) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always true}}
163 if (a
!= 2147483648) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always true}}
165 if (2147483648 == a
) // expected-warning {{comparison of constant 2147483648 with expression of type 'enum A' is always false}}
170 if (-2147483649 >= a
)
174 if (-2147483649 <= a
)
176 if (a
<= -2147483649)
180 if (a
>= -2147483649)
184 if (a
== -2147483649)
186 if (-2147483649 != a
)
188 if (a
!= -2147483649)
190 if (-2147483649 == a
)
221 // https://bugs.llvm.org/show_bug.cgi?id=35009
226 // in C, this should not warn.