1 // Test this without pch.
2 // RUN: %clang_cc1 -fsyntax-only %s -DBODY
3
4 // Test with pch.
5 // RUN: %clang_cc1 -emit-pch -o %t %s
6 // RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -DBODY
7
8 // Test with pch with template instantiation in the pch.
9 // RUN: %clang_cc1 -emit-pch -fpch-instantiate-templates -o %t %s -verify
10
11 #ifndef HEADER_H
12 #define HEADER_H
13
14 template <typename T>
15 void f();
16 struct X; // @16
g()17 void g() { f<X>(); } // @17 instantiation not performed yet
18
19 template <typename T>
f()20 void f() { T t; }; // @20
21
22 #endif
23
24 #ifdef BODY
25 struct X {};
26 #endif
27
28 // expected-error@20 {{variable has incomplete type}}
29 // expected-note@17 {{in instantiation of function template specialization}}
30 // expected-note@16 {{forward declaration}}
31