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