summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorErik Pilkington <erik.pilkington@gmail.com>2018-08-09 20:11:13 +0000
committerErik Pilkington <erik.pilkington@gmail.com>2018-08-09 20:11:13 +0000
commitbe168a9d34dbd6fa5cfbfb7447a06e115e6a775f (patch)
tree27ec6e334aba5df3c75f826dc046dae2087dd6f7 /clang/lib/Sema
parent02a67baf1ea5055aea572f979cc1e45eed0660dc (diff)
downloadbcm5719-llvm-be168a9d34dbd6fa5cfbfb7447a06e115e6a775f.tar.gz
bcm5719-llvm-be168a9d34dbd6fa5cfbfb7447a06e115e6a775f.zip
[Sema] P0961R1: Relaxing the structured bindings customization point finding rules
Differential revision: https://reviews.llvm.org/D50418 llvm-svn: 339375
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaDeclCXX.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index f119a6ef042..12b4557f72e 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -1108,7 +1108,7 @@ static bool checkTupleLikeDecomposition(Sema &S,
// [dcl.decomp]p3:
// The unqualified-id get is looked up in the scope of E by class member
- // access lookup
+ // access lookup ...
LookupResult MemberGet(S, GetDN, Src->getLocation(), Sema::LookupMemberName);
bool UseMemberGet = false;
if (S.isCompleteType(Src->getLocation(), DecompType)) {
@@ -1116,7 +1116,20 @@ static bool checkTupleLikeDecomposition(Sema &S,
S.LookupQualifiedName(MemberGet, RD);
if (MemberGet.isAmbiguous())
return true;
- UseMemberGet = !MemberGet.empty();
+ // ... and if that finds at least one declaration that is a function
+ // template whose first template parameter is a non-type parameter ...
+ for (NamedDecl *D : MemberGet) {
+ if (FunctionTemplateDecl *FTD =
+ dyn_cast<FunctionTemplateDecl>(D->getUnderlyingDecl())) {
+ TemplateParameterList *TPL = FTD->getTemplateParameters();
+ if (TPL->size() != 0 &&
+ isa<NonTypeTemplateParmDecl>(TPL->getParam(0))) {
+ // ... the initializer is e.get<i>().
+ UseMemberGet = true;
+ break;
+ }
+ }
+ }
S.FilterAcceptableTemplateNames(MemberGet);
}
OpenPOWER on IntegriCloud