mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[Strict memory safety] Union member accessors are always unsafe
Union member accessors have no way to know what the "active field" is, so consider them to always be unsafe.
This commit is contained in:
@@ -19,4 +19,9 @@ struct StoreAllTheThings {
|
||||
let ln: ListNode // expected-note{{property 'ln' involves unsafe type 'ListNode'}}
|
||||
|
||||
let sc: SomeColor
|
||||
};
|
||||
}
|
||||
|
||||
func readFromUnion(npu: NoPointersUnion) {
|
||||
// expected-warning@+1{{expression uses unsafe constructs but is not marked with 'unsafe'}}
|
||||
_ = npu.x // expected-note{{reference to unsafe property 'x'}}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user