1 // Test this without pch, template will be instantiated.
2 // RUN: %clang_cc1 -fsyntax-only %s -verify=expected
3 
4 // Test with pch, template will be instantiated in the TU.
5 // RUN: %clang_cc1 -emit-pch -o %t %s -verify=ok
6 // RUN: %clang_cc1 -include-pch %t -fsyntax-only %s -verify=expected
7 
8 // Test with pch with template instantiation in the pch.
9 // RUN: %clang_cc1 -emit-pch -fpch-instantiate-templates -o %t %s -verify=expected
10 
11 // ok-no-diagnostics
12 
13 #ifndef HEADER_H
14 #define HEADER_H
15 
16 template <typename T>
17 struct A {
fooA18   T foo() const { return "test"; } // @18
19 };
20 
bar(A<double> * a)21 double bar(A<double> *a) {
22   return a->foo(); // @22
23 }
24 
25 #endif
26 
27 // expected-error@18 {{cannot initialize return object}}
28 // expected-note@22 {{in instantiation of member function}}
29