Files
swift-mirror/test/Unsafe/unsafe_nonstrict.swift
Doug Gregor 1b94c3b3d6 Always emit "unsafe does not cover any unsafe constructs" warning
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.
2025-04-25 23:22:09 -07:00

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}}
}