From efa919ab074835d1a94fcf2b1a6d1cac03afe20a Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 16 Feb 2017 21:29:21 +0000 Subject: Properly set up the DeclContext for parameters of implicit deduction guides; this is needed for deferred instantiation of default arguments. llvm-svn: 295379 --- clang/lib/Sema/SemaTemplate.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'clang/lib/Sema') diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index 5470017303d..4c5f3bee15b 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -1677,6 +1677,9 @@ private: bool Explicit, TypeSourceInfo *TInfo, SourceLocation LocStart, SourceLocation Loc, SourceLocation LocEnd) { + ArrayRef Params = + TInfo->getTypeLoc().castAs().getParams(); + // Build the implicit deduction guide template. auto *Guide = FunctionDecl::Create(SemaRef.Context, DC, LocStart, Loc, DeductionGuideName, TInfo->getType(), @@ -1685,8 +1688,10 @@ private: if (Explicit) Guide->setExplicitSpecified(); Guide->setRangeEnd(LocEnd); - Guide->setParams( - TInfo->getTypeLoc().castAs().getParams()); + Guide->setParams(Params); + + for (auto *Param : Params) + Param->setDeclContext(Guide); auto *GuideTemplate = FunctionTemplateDecl::Create( SemaRef.Context, DC, Loc, DeductionGuideName, TemplateParams, Guide); -- cgit v1.2.3