In findFunction*, add template instantiation if needed.

Update the test accordingly.
This commit is contained in:
Philippe Canal 2013-11-04 00:07:51 -06:00 committed by sftnight
parent 66d3abc12c
commit 1b8795f0c3
2 changed files with 2 additions and 8 deletions

View File

@ -563,6 +563,8 @@ namespace cling {
// We prefer to get the canonical decl for consistency and ease
// of comparison.
TheDecl = TheDecl->getCanonicalDecl();
if (TheDecl->isTemplateInstantiation() && !TheDecl->isDefined())
S.InstantiateFunctionDefinition(SourceLocation(),TheDecl,true);
}
}
return TheDecl;

View File

@ -125,14 +125,6 @@ public:
void A_n(B& b) { b.B_f(); }
void A_n(const char *msg, int ndim = 0) { if (ndim) ++msg; }
};
// Note: In CINT, looking up a class template specialization causes
// instantiation, but looking up a function template specialization
// does not, so we explicitly request the instantiations we are
// going to lookup so they will be there to find.
template void A::A_k(int);
template void A::A_k(double);
template void A::B_k(int);
template void A::B_k(double);
B b_obj;
B* b_ptr = &b_obj;
B* b_ary = new B[3];