1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -fsyntax-only -Wtautological-constant-out-of-range-compare -verify %s
10 if (a
== 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
12 if (a
!= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
14 if (a
< 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
16 if (a
<= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
18 if (a
> 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
20 if (a
>= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
23 if (0x1234567812345678L
== a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
25 if (0x1234567812345678L
!= a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
27 if (0x1234567812345678L
< a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
29 if (0x1234567812345678L
<= a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
31 if (0x1234567812345678L
> a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
33 if (0x1234567812345678L
>= a
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
35 if (a
== 0x1234567812345678LL
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
37 if (a
== -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always false}}
39 if (a
< -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always false}}
41 if (a
> -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always true}}
43 if (a
<= -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always false}}
45 if (a
>= -0x1234567812345678L
) // expected-warning {{comparison of constant -1311768465173141112 with expression of type 'int' is always true}}
49 if (a
== 0x12345678L
) // no warning
53 if (s
== 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
55 if (s
!= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
57 if (s
< 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
59 if (s
<= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
61 if (s
> 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
63 if (s
>= 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
66 if (0x1234567812345678L
== s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
68 if (0x1234567812345678L
!= s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
70 if (0x1234567812345678L
< s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
72 if (0x1234567812345678L
<= s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always false}}
74 if (0x1234567812345678L
> s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
76 if (0x1234567812345678L
>= s
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'short' is always true}}
80 if (l
== 0x1234567812345678L
)
82 if (l
!= 0x1234567812345678L
)
84 if (l
< 0x1234567812345678L
)
86 if (l
<= 0x1234567812345678L
)
88 if (l
> 0x1234567812345678L
)
90 if (l
>= 0x1234567812345678L
)
93 if (0x1234567812345678L
== l
)
95 if (0x1234567812345678L
!= l
)
97 if (0x1234567812345678L
< l
)
99 if (0x1234567812345678L
<= l
)
101 if (0x1234567812345678L
> l
)
103 if (0x1234567812345678L
>= l
)
113 if (e
== 0x1234567812345678L
) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'enum E' is always false}}