[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / clang / test / CXX / temp / temp.spec / temp.expl.spec / p5.cpp
blob512ea47d5a5f518140dc7c75026ff2ec2def2380
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 struct IntHolder {
4 IntHolder(int);
5 };
7 template<typename T, typename U>
8 struct X {
9 void f() {
10 T t;
13 void g() { }
15 struct Inner {
16 T value;
19 static T value;
22 template<typename T, typename U>
23 T X<T, U>::value;
25 // Explicitly specialize the members of X<IntHolder, long> to not cause
26 // problems with instantiation, but only provide declarations (not definitions).
27 template<>
28 void X<IntHolder, long>::f();
30 template<>
31 struct X<IntHolder, long>::Inner; // expected-note{{forward declaration}}
33 template<>
34 IntHolder X<IntHolder, long>::value;
36 IntHolder &test_X_IntHolderInt(X<IntHolder, long> xih) {
37 xih.g(); // okay
38 xih.f(); // okay, uses specialization
40 X<IntHolder, long>::Inner inner; // expected-error {{incomplete}}
42 return X<IntHolder, long>::value; // okay, uses specialization
46 template<class T> struct A {
47 void f(T) { /* ... */ }
50 template<> struct A<int> {
51 void f(int);
54 void h() {
55 A<int> a;
56 a.f(16); // A<int>::f must be defined somewhere
59 // explicit specialization syntax not used for a member of
60 // explicitly specialized class template specialization
61 void A<int>::f(int) { /* ... */ }