-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.runtimeThe Swift RuntimeThe Swift Runtimestandard libraryArea: Standard library umbrellaArea: Standard library umbrella
Description
Previous ID | SR-4477 |
Radar | rdar://problem/31404278 |
Original Reporter | salutis (JIRA User) |
Type | Bug |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | Standard Library |
Labels | Bug, Runtime |
Assignee | salutis (JIRA) |
Priority | Medium |
md5: c528652076c750121e14e91c0b0093b8
is duplicated by:
- SR-5043 App crashes when calling method on downcasted object
Issue Description:
An EXC_BAD_ACCESS
here:
protocol Something {}
protocol IntContainer {
var ints: [Int] { get set }
}
func processSomething(_ state: Something) {
if let intContainer = state as? Something & IntContainer {
print(intContainer.ints)
}
}
struct MySomething: Something, IntContainer {
var ints: [Int] = []
}
let mySomething = MySomething()
processSomething(mySomething) // EXC_BAD_ACCESS here
The execution stops here:
libswiftCore.dylib`_swift_release_dealloc:
0x11be163e0 <+0>: movq (%rdi), %rax
-> 0x11be163e3 <+3>: jmpq *-0x10(%rax)
0x11be163e6 <+6>: nopw %cs:(%rax,%rax)
Related StackOverflow question with no good answer:
http://stackoverflow.com/questions/35199077/exc-bad-access-using-protocol-composition
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.runtimeThe Swift RuntimeThe Swift Runtimestandard libraryArea: Standard library umbrellaArea: Standard library umbrella