1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -Wtautological-constant-out-of-range-compare -verify %s
9 if (a
== 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
11 if (a
!= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
13 if (a
< 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
15 if (a
<= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
17 if (a
> 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
19 if (a
>= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
22 if (0x1234567812345678L
== a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
24 if (0x1234567812345678L
!= a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
26 if (0x1234567812345678L
< a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
28 if (0x1234567812345678L
<= a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
30 if (0x1234567812345678L
> a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
32 if (0x1234567812345678L
>= a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
34 if (a
== 0x1234567812345678LL
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
36 if (a
== -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always false}}
38 if (a
< -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always false}}
40 if (a
> -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always true}}
42 if (a
<= -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always false}}
44 if (a
>= -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always true}}
48 if (a
== 0x12345678L
) // no warning
52 if (s
== 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
54 if (s
!= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
56 if (s
< 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
58 if (s
<= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
60 if (s
> 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
62 if (s
>= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
65 if (0x1234567812345678L
== s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
67 if (0x1234567812345678L
!= s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
69 if (0x1234567812345678L
< s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
71 if (0x1234567812345678L
<= s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
73 if (0x1234567812345678L
> s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
75 if (0x1234567812345678L
>= s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
79 if (l
== 0x1234567812345678L
)
81 if (l
!= 0x1234567812345678L
)
83 if (l
< 0x1234567812345678L
)
85 if (l
<= 0x1234567812345678L
)
87 if (l
> 0x1234567812345678L
)
89 if (l
>= 0x1234567812345678L
)
92 if (0x1234567812345678L
== l
)
94 if (0x1234567812345678L
!= l
)
96 if (0x1234567812345678L
< l
)
98 if (0x1234567812345678L
<= l
)
100 if (0x1234567812345678L
> l
)
102 if (0x1234567812345678L
>= l
)
112 if (e
== 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'enum E' is always false}}