mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Currently this does nothing, as we're warning by default, but once we error by default, this will downgrade the diagnostic to a warning.
11 lines
515 B
Swift
11 lines
515 B
Swift
// RUN: %target-typecheck-verify-swift -enable-invalid-ephemeralness-as-error
|
|
// REQUIRES: objc_interop
|
|
|
|
func unsafePointerInitEphemeralConversions() {
|
|
class C {}
|
|
var c: C?
|
|
|
|
_ = AutoreleasingUnsafeMutablePointer(&c) // expected-error {{initialization of 'AutoreleasingUnsafeMutablePointer<C?>' results in a dangling pointer}}
|
|
// expected-note@-1 {{implicit argument conversion from 'C?' to 'AutoreleasingUnsafeMutablePointer<C?>' produces a pointer valid only for the duration of the call to 'init(_:)'}}
|
|
}
|