diff options
author | Erik Pilkington <erik.pilkington@gmail.com> | 2018-08-07 22:59:02 +0000 |
---|---|---|
committer | Erik Pilkington <erik.pilkington@gmail.com> | 2018-08-07 22:59:02 +0000 |
commit | 9f9462acf6d95c204849492e5a997f26465ecd0f (patch) | |
tree | eafce8bbf09f62e3da23379b444d103f84956cba /clang/lib | |
parent | 2e60ad2e581d824364fa0cbacfcc0d1aa66ce573 (diff) | |
download | bcm5719-llvm-9f9462acf6d95c204849492e5a997f26465ecd0f.tar.gz bcm5719-llvm-9f9462acf6d95c204849492e5a997f26465ecd0f.zip |
[Sema] Ensure an auto non-type template parameter is dependent
The dependent auto was getting stripped away while rebuilding the template
parameter type, so substitute it in.
rdar://41852459
Differential revision: https://reviews.llvm.org/D50088
llvm-svn: 339198
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaTemplate.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp index fa002de3f5f..f31f0d4957a 100644 --- a/clang/lib/Sema/SemaTemplate.cpp +++ b/clang/lib/Sema/SemaTemplate.cpp @@ -974,7 +974,7 @@ NamedDecl *Sema::ActOnTypeParameter(Scope *S, bool Typename, QualType Sema::CheckNonTypeTemplateParameterType(TypeSourceInfo *&TSI, SourceLocation Loc) { if (TSI->getType()->isUndeducedType()) { - // C++1z [temp.dep.expr]p3: + // C++17 [temp.dep.expr]p3: // An id-expression is type-dependent if it contains // - an identifier associated by name lookup with a non-type // template-parameter declared with a type that contains a @@ -9866,6 +9866,15 @@ bool Sema::RebuildTemplateParamsInCurrentInstantiation( if (!NewTSI) return true; + if (NewTSI->getType()->isUndeducedType()) { + // C++17 [temp.dep.expr]p3: + // An id-expression is type-dependent if it contains + // - an identifier associated by name lookup with a non-type + // template-parameter declared with a type that contains a + // placeholder type (7.1.7.4), + NewTSI = SubstAutoTypeSourceInfo(NewTSI, Context.DependentTy); + } + if (NewTSI != NTTP->getTypeSourceInfo()) { NTTP->setTypeSourceInfo(NewTSI); NTTP->setType(NewTSI->getType()); |