Closed
Description
Previous ID | SR-15121 |
Radar | None |
Original Reporter | @DeFrenZ |
Type | Bug |
Status | Resolved |
Resolution | Done |
Additional Detail from JIRA
Votes | 0 |
Component/s | |
Labels | Bug |
Assignee | None |
Priority | Medium |
md5: 1b2bc84d40d51034214b603bf5e65311
Issue Description:
final class WorkItem {
let work: () -> Void
init(work: @escaping () -> Void) {
self.work = work
}
}
var items: [WorkItem] = [
.init(work: { print("foo") }),
]
items.forEach(\.work) // SEGFAULT
items.forEach({ $0.work() }) // WORKS
This doesn't crash if `WorkItem` is a `struct` instead, but doesn't print either (without the correct call).
The last stack item before the crash is "libswiftCore.dylib`swift::metadataimpl::ValueWitnesses<(anonymous namespace)::ThickFunctionBox>::initializeWithTake"
The issue is that it probably shouldn't compile at all with the expression, since the type mismatches