-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Open
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.triage neededThis issue needs more specific labelsThis issue needs more specific labels
Description
Description
see title
Reproduction
// compile with swiftc -enable-testing ...
protocol Fooable: ~Copyable { }
struct Foo: Fooable, ~Copyable {
// Compiles
var value: Int {
nonmutating get { 0 }
nonmutating set { }
}
}
extension Fooable where Self: ~Copyable {
// Fails to compile:
// "Copy of noncopyable typed value.
// This is a compiler bug.
// Please file a bug with a small example of the bug"
var valueTwo: Int {
nonmutating get { 0 }
nonmutating set { }
}
}
Expected behavior
the code should compile regardless of whether -enable-testing
is applied
Environment
Apple Swift version 6.1.2 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
Target: arm64-apple-macosx15.0
Additional information
godbolt: https://swift.godbolt.org/z/E5qo9ob5f
originally reported via forum post by Matt Curtis: https://forums.swift.org/t/nonmutating-set-treated-differently-in-protocol-extension/81854
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.triage neededThis issue needs more specific labelsThis issue needs more specific labels