forked from OSchip/llvm-project
Slightly improve the semantics of extern templates for member functions of class templates
llvm-svn: 83063
This commit is contained in:
parent
139c3dba53
commit
a49cb4e494
|
@ -977,10 +977,11 @@ Sema::InstantiateClassMembers(SourceLocation PointOfInstantiation,
|
|||
DEnd = Instantiation->decls_end();
|
||||
D != DEnd; ++D) {
|
||||
if (FunctionDecl *Function = dyn_cast<FunctionDecl>(*D)) {
|
||||
if (!Function->getBody())
|
||||
if (!Function->getBody() && TSK != TSK_ExplicitInstantiationDeclaration)
|
||||
InstantiateFunctionDefinition(PointOfInstantiation, Function);
|
||||
} else if (VarDecl *Var = dyn_cast<VarDecl>(*D)) {
|
||||
if (Var->isStaticDataMember())
|
||||
if (Var->isStaticDataMember() &&
|
||||
TSK != TSK_ExplicitInstantiationDeclaration)
|
||||
InstantiateStaticDataMemberDefinition(PointOfInstantiation, Var);
|
||||
} else if (CXXRecordDecl *Record = dyn_cast<CXXRecordDecl>(*D)) {
|
||||
if (!Record->isInjectedClassName() && !Record->getDefinition(Context)) {
|
||||
|
|
|
@ -39,3 +39,29 @@ void test_longptr(X0<long*> xl, X0<long*>::Inner xli) {
|
|||
}
|
||||
|
||||
template class X0<long*>;
|
||||
|
||||
template<typename T>
|
||||
class X1 {
|
||||
public:
|
||||
void f(T t) { t += 2; }
|
||||
|
||||
void g(T t);
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
void X1<T>::g(T t) {
|
||||
t += 2;
|
||||
}
|
||||
|
||||
extern template class X1<void*>;
|
||||
|
||||
void g_X1(X1<void*> x1, void *ptr) {
|
||||
x1.g(ptr);
|
||||
}
|
||||
|
||||
extern template void X1<const void*>::g(const void*);
|
||||
|
||||
void g_X1_2(X1<const void *> x1, const void *ptr) {
|
||||
// FIXME: This should not instantiate of x1<const void*>::g
|
||||
// x1.g(ptr);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue