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