@@ -1009,14 +1009,16 @@ struct BindingInitWalker {
10091009 using BindingItrTy = typename ArrayRef<BindingDecl *>::iterator;
10101010 using PackExprItrTy = typename MutableArrayRef<Expr *>::iterator;
10111011 Sema &SemaRef;
1012+ DecompositionDecl *DecompDecl;
10121013 ArrayRef<BindingDecl *> Bindings;
10131014 ResolvedUnexpandedPackExpr *PackExpr = nullptr;
10141015 MutableArrayRef<Expr *> PackExprNodes;
10151016 BindingItrTy BindingItr;
10161017 PackExprItrTy PackExprItr;
10171018
1018- BindingInitWalker(Sema &S, ArrayRef<BindingDecl *> Bs)
1019- : SemaRef(S), Bindings(Bs), BindingItr(Bindings.begin()) {}
1019+ BindingInitWalker(Sema &S, DecompositionDecl *DD, ArrayRef<BindingDecl *> Bs)
1020+ : SemaRef(S), DecompDecl(DD), Bindings(Bs), BindingItr(Bindings.begin()) {
1021+ }
10201022
10211023 BindingDecl *get() { return *BindingItr; }
10221024
@@ -1037,7 +1039,7 @@ struct BindingInitWalker {
10371039 B->getLocation(), B->getIdentifier(), T);
10381040
10391041 NestedBD->setBinding(T, E);
1040- NestedBD->setDecomposedDecl(nullptr );
1042+ NestedBD->setDecomposedDecl(DecompDecl );
10411043 auto *DE = SemaRef.BuildDeclRefExpr(NestedBD, T.getNonReferenceType(),
10421044 VK_LValue, B->getLocation());
10431045 *PackExprItr = DE;
@@ -1065,7 +1067,7 @@ static bool checkSimpleDecomposition(
10651067 return true;
10661068 }
10671069
1068- auto Walker = BindingInitWalker(S, Bindings);
1070+ auto Walker = BindingInitWalker(S, cast<DecompositionDecl>(Src), Bindings);
10691071 for (unsigned I = 0; I < NumElems; I++) {
10701072 BindingDecl *B = Walker.get();
10711073 SourceLocation Loc = B->getLocation();
@@ -1350,7 +1352,7 @@ static bool checkTupleLikeDecomposition(Sema &S,
13501352 }
13511353 }
13521354
1353- auto Walker = BindingInitWalker(S, Bindings);
1355+ auto Walker = BindingInitWalker(S, cast<DecompositionDecl>(Src), Bindings);
13541356 for (unsigned I = 0; I < NumElems; I++) {
13551357 BindingDecl *B = Walker.get();
13561358 InitializingBinding InitContext(S, B);
@@ -1541,7 +1543,7 @@ static bool checkMemberDecomposition(Sema &S, ArrayRef<BindingDecl*> Bindings,
15411543 return true;
15421544 }
15431545
1544- auto Walker = BindingInitWalker(S, Bindings);
1546+ auto Walker = BindingInitWalker(S, cast<DecompositionDecl>(Src), Bindings);
15451547
15461548 // all of E's non-static data members shall be [...] well-formed
15471549 // when named as e.name in the context of the structured binding,
0 commit comments