Home | History | Annotate | Download | only in PCH
      1 // Test this without pch.
      2 // RUN: %clang_cc1 %s -include %s -verify -fsyntax-only
      3 
      4 // Test with pch.
      5 // RUN: %clang_cc1 %s -emit-pch -o %t
      6 // RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only
      7 
      8 #ifndef HEADER
      9 #define HEADER
     10 
     11 #pragma clang diagnostic push
     12 #pragma clang diagnostic ignored "-Wtautological-compare"
     13 template <typename T>
     14 struct TS1 {
     15     void m() {
     16       T a = 0;
     17       T b = a==a;
     18     }
     19 };
     20 #pragma clang diagnostic pop
     21 
     22 #else
     23 
     24 
     25 template <typename T>
     26 struct TS2 {
     27     void m() {
     28       T a = 0;
     29       T b = a==a; // expected-warning {{self-comparison always evaluates to true}} expected-note@39 {{in instantiation of member function}}
     30     }
     31 };
     32 
     33 void f() {
     34     TS1<int> ts1;
     35     ts1.m();
     36 
     37 
     38     TS2<int> ts2;
     39     ts2.m();
     40 }
     41 
     42 #endif
     43