Skip to content

Commit d0d038b

Browse files
committed
SILGen: Fix early return from enum payload initialization
This is a regression from the following commit, caught by validation-tests/stdlib/String: 7496730 I'll add SILGen tests for this case later, for now just fix the broken build.
1 parent be663a4 commit d0d038b

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3145,15 +3145,10 @@ ManagedValue SILGenFunction::emitInjectEnum(SILLocation loc,
31453145
} else {
31463146
// The payload is address-only. Evaluate it directly into
31473147
// the enum.
3148-
CleanupHandle cleanup = enterDestroyCleanup(resultSlot);
3149-
Cleanups.setCleanupState(cleanup, CleanupState::Dormant);
31503148

3151-
TemporaryInitialization dest(resultData, cleanup);
3149+
TemporaryInitialization dest(resultData, CleanupHandle::invalid());
31523150
std::move(payload).forwardInto(*this, origFormalType,
31533151
&dest, payloadTL);
3154-
3155-
// Kill the old cleanup -- we're going to enter a new one.
3156-
Cleanups.setCleanupState(cleanup, CleanupState::Dead);
31573152
}
31583153

31593154
// The payload is initialized, now apply the tag.

0 commit comments

Comments
 (0)