blob: fb15ec843061db56c2aa0abdee7d0ec2c29e7d2e [file] [log] [blame]
Eli Friedman5a722e92013-09-06 03:13:09 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2
3int foo(int x) {
4 return x == x; // expected-warning {{self-comparison always evaluates to true}}
5}
6
7struct X {
8 bool operator==(const X &x);
9};
10
11struct A {
12 int x;
13 X x2;
14 int a[3];
15 int b[3];
16 bool f() { return x == x; } // expected-warning {{self-comparison always evaluates to true}}
17 bool g() { return x2 == x2; } // no-warning
18 bool h() { return a == b; } // expected-warning {{array comparison always evaluates to false}}
19 bool i() {
20 int c[3];
21 return a == c; // expected-warning {{array comparison always evaluates to false}}
22 }
23};