From 36c49e3f258dced101949edabd72e9bc3f1dedc4 Mon Sep 17 00:00:00 2001 From: dim Date: Fri, 17 Sep 2010 15:54:40 +0000 Subject: Vendor import of clang r114020 (from the release_28 branch): http://llvm.org/svn/llvm-project/cfe/branches/release_28@114020 Approved by: rpaulo (mentor) --- test/CXX/temp/temp.spec/temp.explicit/p3.cpp | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) (limited to 'test/CXX/temp/temp.spec/temp.explicit/p3.cpp') diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp index e9758bc..48c42c3 100644 --- a/test/CXX/temp/temp.spec/temp.explicit/p3.cpp +++ b/test/CXX/temp/temp.spec/temp.explicit/p3.cpp @@ -2,8 +2,9 @@ // A declaration of a function template shall be in scope at the point of the // explicit instantiation of the function template. -template void f0(T) { } +template void f0(T); template void f0(int); // okay +template void f0(T) { } // A definition of the class or class template containing a member function // template shall be in scope at the point of the explicit instantiation of @@ -47,3 +48,27 @@ template X2::X2(); // expected-error{{not an instantiation}} template X2::X2(const X2&); // expected-error{{not an instantiation}} template X2::~X2(); // expected-error{{not an instantiation}} template X2 &X2::operator=(const X2&); // expected-error{{not an instantiation}} + + +// A definition of a class template is sufficient to explicitly +// instantiate a member of the class template which itself is not yet defined. +namespace PR7979 { + template struct S { + void f(); + static void g(); + static int i; + struct S2 { + void h(); + }; + }; + + template void S::f(); + template void S::g(); + template int S::i; + template void S::S2::h(); + + template void S::f() {} + template void S::g() {} + template int S::i; + template void S::S2::h() {} +} -- cgit v1.1