blob: 023afb7926f029cda7cf5938cbf29907fe4666e5 [file] [log] [blame]
Ted Kremenek3ca0bf22007-10-29 16:58:49 +00001// RUN: clang -fsyntax-only -verify %s
2
3int foo(int x) {
4 return x == x; // expected-warning {{self-comparison always results}}
5}
6
7int foo2(int x) {
8 return (x) != (((x))); // expected-warning {{self-comparison always results}}
9}
10
Ted Kremeneka8335a92007-10-29 17:02:56 +000011int qux(int x) {
12 return x < x; // expected-warning {{self-comparison}}
13}
14
15int qux2(int x) {
16 return x > x; // expected-warning {{self-comparison}}
17}
18
Ted Kremenek3ca0bf22007-10-29 16:58:49 +000019int bar(float x) {
20 return x == x; // no-warning
21}
22
23int bar2(float x) {
24 return x != x; // no-warning
Ted Kremeneka8335a92007-10-29 17:02:56 +000025}