Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 
      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];
     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 };
     24