1*f4a2713aSLionel Sambuc // Test this without pch. 2*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -include %s -verify -fsyntax-only -Wuninitialized 3*f4a2713aSLionel Sambuc 4*f4a2713aSLionel Sambuc // Test with pch. 5*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -emit-pch -o %t 6*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -include-pch %t -verify -fsyntax-only -Wuninitialized 7*f4a2713aSLionel Sambuc 8*f4a2713aSLionel Sambuc #ifndef HEADER 9*f4a2713aSLionel Sambuc #define HEADER 10*f4a2713aSLionel Sambuc 11*f4a2713aSLionel Sambuc #pragma clang diagnostic push 12*f4a2713aSLionel Sambuc #pragma clang diagnostic ignored "-Wuninitialized" 13*f4a2713aSLionel Sambuc template <typename T> 14*f4a2713aSLionel Sambuc struct TS1 { mTS115*f4a2713aSLionel Sambuc void m() { 16*f4a2713aSLionel Sambuc T a; 17*f4a2713aSLionel Sambuc T b = a; 18*f4a2713aSLionel Sambuc } 19*f4a2713aSLionel Sambuc }; 20*f4a2713aSLionel Sambuc #pragma clang diagnostic pop 21*f4a2713aSLionel Sambuc 22*f4a2713aSLionel Sambuc #else 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambuc 25*f4a2713aSLionel Sambuc template <typename T> 26*f4a2713aSLionel Sambuc struct TS2 { mTS227*f4a2713aSLionel Sambuc void m() { 28*f4a2713aSLionel Sambuc T a; 29*f4a2713aSLionel Sambuc T b = a; // expected-warning {{variable 'a' is uninitialized}} \ 30*f4a2713aSLionel Sambuc expected-note@41 {{in instantiation of member function}} \ 31*f4a2713aSLionel Sambuc expected-note@28 {{initialize the variable 'a' to silence}} 32*f4a2713aSLionel Sambuc } 33*f4a2713aSLionel Sambuc }; 34*f4a2713aSLionel Sambuc f()35*f4a2713aSLionel Sambucvoid f() { 36*f4a2713aSLionel Sambuc TS1<int> ts1; 37*f4a2713aSLionel Sambuc ts1.m(); 38*f4a2713aSLionel Sambuc 39*f4a2713aSLionel Sambuc 40*f4a2713aSLionel Sambuc TS2<int> ts2; 41*f4a2713aSLionel Sambuc ts2.m(); 42*f4a2713aSLionel Sambuc } 43*f4a2713aSLionel Sambuc 44*f4a2713aSLionel Sambuc #endif 45