diff --git a/core/clingutils/src/TClingUtils.cxx b/core/clingutils/src/TClingUtils.cxx index eee4d0e0c6a4e..e938d167c1d02 100644 --- a/core/clingutils/src/TClingUtils.cxx +++ b/core/clingutils/src/TClingUtils.cxx @@ -4631,11 +4631,13 @@ clang::QualType ROOT::TMetaUtils::ReSubstTemplateArg(clang::QualType input, cons } else { replacedCtxt = decl->getDescribedClassTemplate(); } + } else if (auto const declguide = llvm::dyn_cast(replacedDeclCtxt)) { + replacedCtxt = llvm::dyn_cast(declguide->getDeducedTemplate()); } else { replacedCtxt = llvm::dyn_cast(replacedDeclCtxt); } - if (replacedCtxt->getCanonicalDecl() == TSTdecl->getSpecializedTemplate()->getCanonicalDecl() + if ((replacedCtxt && replacedCtxt->getCanonicalDecl() == TSTdecl->getSpecializedTemplate()->getCanonicalDecl()) || /* the following is likely just redundant */ substType->getReplacedParameter()->getDecl() == TSTdecl->getSpecializedTemplate ()->getTemplateParameters()->getParam(index))