mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
SIL: Casts that may be to NSError must use indirect cast instructions.
checked_cast_br promises to maintain RC identity, but a cast from an ErrorType-conforming class to NSError may change the RC identity by bridging. Make sure that potential class-to-NSError casts go through the indirect cast entry points for now. The runtime implementation still needs to be fixed to handle the class-to-NSError case, but this is part of rdar://problem/21116814. Swift SVN r29089
This commit is contained in:
@@ -1452,7 +1452,8 @@ emitSerialCastOperand(SILGenFunction &SGF, SILLocation loc,
|
||||
bool requiresAddress = false;
|
||||
for (auto &row : rows) {
|
||||
CanType targetType = getTargetType(row);
|
||||
if (!canUseScalarCheckedCastInstructions(sourceType, targetType)) {
|
||||
if (!canUseScalarCheckedCastInstructions(SGF.SGM.M,
|
||||
sourceType, targetType)) {
|
||||
requiresAddress = true;
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user