Open
Description
Description
Compiling code that uses a ReferenceWritableKeyPath on an instance that has been constrained to AnyObject results in the error "copy of noncopyable typed value. This is a compiler bug. Please file a bug with a small example of the bug".
Reproduction
func assign<Resource, Target: AnyObject>(
target: consuming Target,
path: ReferenceWritableKeyPath<Target, Resource>,
source: Resource
) {
target[keyPath: path] = source
}
Expected behavior
Using a key path in this fashion does not result in an error.
Environment
swift-driver version: 1.115 Apple Swift version 6.0 (swiftlang-6.0.0.9.10 clang-1600.0.26.2)
Target: arm64-apple-macosx15.0
Additional information
You can work around it by re-declaring the variable (like let target = target
).