Open groue opened 2 months ago
The trunk and swift 6 snapshots crash on compilation, not at runtime: #74458
cc @gottesmm
Bug still present in Xcode 16.0 beta 3 (16A5202i)
% swiftc -v
Apple Swift version 6.0 (swiftlang-6.0.0.5.15 clang-1600.0.22.6)
Target: arm64-apple-macosx14.0
Bug still present in Xcode 16.0 beta 4
Description
Hello,
A Swift program that wraps a "sending" closure parameter in a struct crashes at runtime
EXC_BAD_ACCESS (code=1, address=0x0)
.Programs do this as a workaround for the warnings/errors described at #73315. They were were eventually identified as unavoidable by @rjmccall in this forum post. We thus need to instruct the compiler that the program is valid through the mean of unchecked constructs, such as wrapping the
sending
closure in an uncheckedSendable
wrapper that can cross isolation domains.As an illustration of the problem, please find attached a small package that adds the following method to
DispatchQueue
.This method compiles fine, but crashes at runtime.
Reproduction
Full package: SwiftIssue.zip
Package.swift
SwiftIssue.swift
SwiftIssueTests.swift
Stack dump
Expected behavior
No crash
Environment
swift-driver version: 1.109.2 Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10) Target: arm64-apple-macosx14.0
Additional information
The program crashes in both Swift 5 and Swift 6 language modes.
I know a workaround: