mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Check for unsafe constructs in all modes, so that we can emit the "unsafe does not cover any unsafe constructs" warning consistently. One does not need to write "unsafe" outside of strict memory safety mode, but if you do... it needs to cover unsafe behavior.
19 lines
350 B
Swift
19 lines
350 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
@unsafe func unsafeFunc() { }
|
|
|
|
@unsafe
|
|
struct UnsafeType { }
|
|
|
|
protocol P { }
|
|
|
|
struct X: @unsafe P { }
|
|
|
|
func acceptP<T: P>(_: T) { }
|
|
|
|
func testItAll(ut: UnsafeType, x: X, i: Int) {
|
|
_ = unsafe ut
|
|
unsafe acceptP(x)
|
|
_ = unsafe i // expected-warning{{no unsafe operations occur within 'unsafe' expression}}
|
|
}
|