summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2017-02-16 21:29:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2017-02-16 21:29:21 +0000
commitefa919ab074835d1a94fcf2b1a6d1cac03afe20a (patch)
treecdb7d7662d9fb7f302f4d712c902ed377303acee /clang/lib/Sema
parent493fb266ed8eb3e2de4c9d5013c9870d555948dc (diff)
downloadbcm5719-llvm-efa919ab074835d1a94fcf2b1a6d1cac03afe20a.tar.gz
bcm5719-llvm-efa919ab074835d1a94fcf2b1a6d1cac03afe20a.zip
Properly set up the DeclContext for parameters of implicit deduction guides;
this is needed for deferred instantiation of default arguments. llvm-svn: 295379
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaTemplate.cpp9
1 files changed, 7 insertions, 2 deletions
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<ParmVarDecl *> Params =
+ TInfo->getTypeLoc().castAs<FunctionProtoTypeLoc>().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<FunctionProtoTypeLoc>().getParams());
+ Guide->setParams(Params);
+
+ for (auto *Param : Params)
+ Param->setDeclContext(Guide);
auto *GuideTemplate = FunctionTemplateDecl::Create(
SemaRef.Context, DC, Loc, DeductionGuideName, TemplateParams, Guide);
OpenPOWER on IntegriCloud