1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2
foo(int x)3 int foo(int x) {
4 return x == x; // expected-warning {{self-comparison always evaluates to true}}
5 }
6
7 struct X {
8 bool operator==(const X &x);
9 };
10
11 struct A {
12 int x;
13 X x2;
14 int a[3];
15 int b[3];
fA16 bool f() { return x == x; } // expected-warning {{self-comparison always evaluates to true}}
gA17 bool g() { return x2 == x2; } // no-warning
hA18 bool h() { return a == b; } // expected-warning {{array comparison always evaluates to false}}
iA19 bool i() {
20 int c[3];
21 return a == c; // expected-warning {{array comparison always evaluates to false}}
22 }
23 };
24