2007-10-30 00:58:49 +08:00
|
|
|
// RUN: clang -fsyntax-only -verify %s
|
|
|
|
|
|
|
|
int foo(int x) {
|
|
|
|
return x == x; // expected-warning {{self-comparison always results}}
|
|
|
|
}
|
|
|
|
|
|
|
|
int foo2(int x) {
|
|
|
|
return (x) != (((x))); // expected-warning {{self-comparison always results}}
|
|
|
|
}
|
|
|
|
|
2007-10-30 01:02:56 +08:00
|
|
|
int qux(int x) {
|
|
|
|
return x < x; // expected-warning {{self-comparison}}
|
|
|
|
}
|
|
|
|
|
|
|
|
int qux2(int x) {
|
|
|
|
return x > x; // expected-warning {{self-comparison}}
|
|
|
|
}
|
|
|
|
|
2007-10-30 00:58:49 +08:00
|
|
|
int bar(float x) {
|
|
|
|
return x == x; // no-warning
|
|
|
|
}
|
|
|
|
|
|
|
|
int bar2(float x) {
|
|
|
|
return x != x; // no-warning
|
2007-10-30 01:02:56 +08:00
|
|
|
}
|