1 // Test this without pch. 2 // RUN: %clang_cc1 %s -include %s -verify -fsyntax-only -Wuninitialized 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 -Wuninitialized 7 8 #ifndef HEADER 9 #define HEADER 10 11 #pragma clang diagnostic push 12 #pragma clang diagnostic ignored "-Wuninitialized" 13 template <typename T> 14 struct TS1 { 15 void m() { 16 T a; 17 T b = 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; 29 T b = a; // expected-warning {{variable 'a' is uninitialized}} \ 30 expected-note@41 {{in instantiation of member function}} \ 31 expected-note@28 {{initialize the variable 'a' to silence}} 32 } 33 }; 34 35 void f() { 36 TS1<int> ts1; 37 ts1.m(); 38 39 40 TS2<int> ts2; 41 ts2.m(); 42 } 43 44 #endif 45