33 lines · cpp
1// Test this without pch.2// RUN: %clang_cc1 -fsyntax-only -verify -DBODY %s3 4// Test with pch.5// RUN: %clang_cc1 -emit-pch -o %t %s6// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify -DBODY %s7 8// RUN: %clang_cc1 -emit-pch -fpch-instantiate-templates -o %t %s9// RUN: %clang_cc1 -include-pch %t -fsyntax-only -verify -DBODY %s10 11#ifndef HEADER_H12#define HEADER_H13 14template <typename T>15struct A {16 int foo() const;17};18 19int bar(A<double> *a) {20 return a->foo();21}22 23#endif // HEADER_H24 25#ifdef BODY26 27template <>28int 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 // BODY33