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