Skip to content

Commit 2373421

Browse files
committed
[Windows]: explicitly set closure captures
MSVC isn't seeing that `CheckDefaultInitializer` is declared and being implicitly captured by reference by the closure going into the `forEachVariable`. Capturing `HasStorage` and `CheckDefaultInitializer` explicitly.
1 parent dc38375 commit 2373421

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/Sema/CodeSynthesis.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -847,15 +847,16 @@ bool AreAllStoredPropertiesDefaultInitableRequest::evaluate(
847847
for (auto idx : range(pbd->getNumPatternEntries())) {
848848
bool HasStorage = false;
849849
bool CheckDefaultInitializer = true;
850-
pbd->getPattern(idx)->forEachVariable([&](VarDecl *VD) {
851-
// If one of the bound variables is @NSManaged, go ahead no matter
852-
// what.
853-
if (VD->getAttrs().hasAttribute<NSManagedAttr>())
854-
CheckDefaultInitializer = false;
855-
856-
if (VD->hasStorageOrWrapsStorage())
857-
HasStorage = true;
858-
});
850+
pbd->getPattern(idx)->forEachVariable(
851+
[&HasStorage, &CheckDefaultInitializer](VarDecl *VD) {
852+
// If one of the bound variables is @NSManaged, go ahead no matter
853+
// what.
854+
if (VD->getAttrs().hasAttribute<NSManagedAttr>())
855+
CheckDefaultInitializer = false;
856+
857+
if (VD->hasStorageOrWrapsStorage())
858+
HasStorage = true;
859+
});
859860

860861
if (!HasStorage) continue;
861862

0 commit comments

Comments
 (0)