aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/self-comparison.c
blob: 023afb7926f029cda7cf5938cbf29907fe4666e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// 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}}
}

int qux(int x) {
   return x < x; // expected-warning {{self-comparison}}
}

int qux2(int x) {
   return x > x; // expected-warning {{self-comparison}}
}

int bar(float x) {
  return x == x; // no-warning
}

int bar2(float x) {
  return x != x; // no-warning
}