diff --git a/clang/lib/AST/DeclTemplate.cpp b/clang/lib/AST/DeclTemplate.cpp index 79a36109276f0..0160b1f7f7d2c 100644 --- a/clang/lib/AST/DeclTemplate.cpp +++ b/clang/lib/AST/DeclTemplate.cpp @@ -207,22 +207,23 @@ unsigned TemplateParameterList::getDepth() const { return cast(FirstParm)->getDepth(); } -static bool AdoptTemplateParameterList(TemplateParameterList *Params, - DeclContext *Owner) { - bool Invalid = false; - for (NamedDecl *P : *Params) { - P->setDeclContext(Owner); - - if (const auto *TTP = dyn_cast(P)) - if (AdoptTemplateParameterList(TTP->getTemplateParameters(), Owner)) - Invalid = true; - - if (P->isInvalidDecl()) - Invalid = true; - } - return Invalid; +static bool AdoptTemplateParameterList ( TemplateParameterList * Params , + DeclContext * Owner ) { +bool Invalid = false ; +for ( NamedDecl * P : * Params ) { +P -> setDeclContext ( Owner ) ; + +if ( const auto * TTP = dyn_cast < TemplateTemplateParmDecl > ( P ) ) +if ( AdoptTemplateParameterList ( TTP -> getTemplateParameters() , Owner ) ) +Invalid = true ; + +if ( P -> isInvalidDecl() ) +Invalid = true ; +} +return Invalid ; } + void TemplateParameterList::getAssociatedConstraints( llvm::SmallVectorImpl &ACs) const { if (HasConstrainedParameters)