From: Axel Naumann Date: Wed, 24 Sep 2014 09:23:19 +0000 (+0200) Subject: Find the RedeclTmplt with the default args. X-Git-Tag: v6-02-00-rc1~13 X-Git-Url: https://root.cern.ch/gitweb?p=root.git;a=commitdiff_plain;h=28bfa81cbcb72db23a76f18f540795f58bba7d3b Find the RedeclTmplt with the default args. --- diff --git a/core/metautils/src/TMetaUtils.cxx b/core/metautils/src/TMetaUtils.cxx index 55f2596..e36f711 100644 --- a/core/metautils/src/TMetaUtils.cxx +++ b/core/metautils/src/TMetaUtils.cxx @@ -3505,7 +3505,16 @@ static void KeepNParams(clang::QualType& normalizedType, normalizedType = clang::QualType(etype->getNamedType().getTypePtr(),0); } - TemplateParameterList* tParsPtr = ctd->getTemplateParameters(); + // The canonical decl does not necessarily have the template default arguments. + // Need to walk through the redecl chain to find it (we know tehre will be no + // inconsistencies, at least) + const clang::ClassTemplateDecl* ctdWithDefaultArgs = ctd; + for (const RedeclarableTemplateDecl* rd: ctdWithDefaultArgs->redecls()) { + clang::TemplateParameterList* tpl = rd->getTemplateParameters(); + if (tpl->getMinRequiredArguments () < tpl->size()) + ctdWithDefaultArgs = llvm::dyn_cast(rd); + } + TemplateParameterList* tParsPtr = ctdWithDefaultArgs->getTemplateParameters(); const TemplateParameterList& tPars = *tParsPtr; const TemplateArgumentList& tArgs = ctsd->getTemplateArgs();