Skip to content

Commit 0cf63fa

Browse files
Make sure immutable weak captures are captured by without boxing
1 parent 35c396c commit 0cf63fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/SIL/IR/TypeLowering.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ CaptureKind TypeConverter::getDeclCaptureKind(CapturedValue capture,
175175
// have the same lifetime as the closure itself, so we must capture
176176
// the box itself and not the payload, even if the closure is noescape,
177177
// otherwise they will be destroyed when the closure is formed.
178-
if (var->getInterfaceType()->is<ReferenceStorageType>()) {
178+
if (var->getInterfaceType()->is<ReferenceStorageType>() && !Context.LangOpts.hasFeature(Feature::WeakLet)) {
179179
return CaptureKind::Box;
180180
}
181181

0 commit comments

Comments
 (0)