Skip to content

Commit 78e9af7

Browse files
committed
SILGen: Fix ownership violation in visitUnderlyingToOpaqueExpr()
1 parent 421f39a commit 78e9af7

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

lib/SILGen/SILGenExpr.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,11 +2129,9 @@ RValue RValueEmitter::visitUnderlyingToOpaqueExpr(UnderlyingToOpaqueExpr *E,
21292129
if (value.getType() == opaqueTL.getLoweredType())
21302130
return RValue(SGF, E, value);
21312131

2132-
auto cast = SGF.B.createUncheckedReinterpretCast(E, value.forward(SGF),
2133-
opaqueTL.getLoweredType());
2134-
value = SGF.emitManagedRValueWithCleanup(cast);
2135-
2136-
return RValue(SGF, E, value);
2132+
auto cast = SGF.B.createUncheckedBitCast(E, value,
2133+
opaqueTL.getLoweredType());
2134+
return RValue(SGF, E, cast);
21372135
}
21382136

21392137
VarargsInfo Lowering::emitBeginVarargs(SILGenFunction &SGF, SILLocation loc,

0 commit comments

Comments
 (0)