1 // RUN: %clang_cc1 -emit-pch -o %t %s
2 // RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -verify
3 // RUN: %clang_cc1 -fsyntax-only -include-pch %t %s -Wuninitialized -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
4
5 #ifndef HEADER
6 #define HEADER
7
8 #define NULL 0
9 template<typename T>
f()10 void *f() {
11 void *p; // @11
12 return p; // @12
13 }
14 #undef NULL
15 template<typename T>
g()16 void *g() {
17 void *p; // @17
18 return p; // @18
19 }
20
21 #else
22
23 // expected-warning@12 {{uninitialized}}
24 // expected-note@11 {{initialize}}
25 // CHECK: fix-it:"{{.*}}":{11:10-11:10}:" = NULL"
26
27 // expected-warning@18 {{uninitialized}}
28 // expected-note@17 {{initialize}}
29 // CHECK: fix-it:"{{.*}}":{17:10-17:10}:" = 0"
30
main()31 int main() {
32 f<int>(); // expected-note {{instantiation}}
33 g<int>(); // expected-note {{instantiation}}
34 }
35
36 #endif
37