Skip to content

Commit

Permalink
Handle CXXDeductionGuide in ReSubstTemplateArg.
Browse files Browse the repository at this point in the history
This fixes ROOT-9147.

Also avoid future cases of nullptr dereference
  • Loading branch information
pcanal committed Feb 5, 2018
1 parent 5c72506 commit f0dc921
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/clingutils/src/TClingUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -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<clang::CXXDeductionGuideDecl>(replacedDeclCtxt)) {
replacedCtxt = llvm::dyn_cast<clang::ClassTemplateDecl>(declguide->getDeducedTemplate());
} else {
replacedCtxt = llvm::dyn_cast<clang::ClassTemplateDecl>(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))
Expand Down

0 comments on commit f0dc921

Please sign in to comment.