| 1 |
// Test this without pch. |
| 2 |
// RUN: %clang_cc1 -fsyntax-only -verify -DBODY %s |
| 3 |
|
| 4 |
// Test with pch. |
| 5 |
// RUN: %clang_cc1 -emit-pch -o %t %s |
| 6 |
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify -DBODY %s |
| 7 |
|
| 8 |
// RUN: %clang_cc1 -emit-pch -fpch-instantiate-templates -o %t %s |
| 9 |
// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify -DBODY %s |
| 10 |
|
| 11 |
#ifndef HEADER_H |
| 12 |
#define HEADER_H |
| 13 |
|
| 14 |
template <typename T> |
| 15 |
struct A { |
| 16 |
int foo() const; |
| 17 |
}; |
| 18 |
|
| 19 |
int bar(A<double> *a) { |
| 20 |
return a->foo(); |
| 21 |
} |
| 22 |
|
| 23 |
#endif // HEADER_H |
| 24 |
|
| 25 |
#ifdef BODY |
| 26 |
|
| 27 |
template <> |
| 28 |
int A<double>::foo() const { // expected-error {{explicit specialization of 'foo' after instantiation}} // expected-note@20 {{implicit instantiation first required here}} |
| 29 |
return 10; |
| 30 |
} |
| 31 |
|
| 32 |
#endif // BODY |