TemplateInstance::enclosing, also does not get you the
instantiating context, referring to the comment in the source
code, I think for my tests it was null.
importedFrom was no solution either. The only thing that worked
for me was walking up with tinst and then use loc. This way you
get the instantiating file. (Got that from
printInstantiationTrace) I think it should be possible to use
this found file name to find the module by iterating
Module::modules, but I have not even bothered trying, because I
felt there has to be some better way, unfortunately I also got no
replies.
At least it helps that I am not alone with this problem :-)
Maybe it is not entirely unlikely that there is in fact no better
way, as apart from "where do I put the instantiated template" and
error messages there is really no need to know where the template
got instantiated.
Best regards,
Robert