Files
swift-mirror/test/stdlib/AutoreleasingUnsafeMutablePointerDiagnostics_warning.swift
Hamish Knight 1bc56dcc11 [stdlib] Mark some parameters @_nonEphemeral
These include the pointer-to-pointer and pointer-to-buffer-pointer
initialiser parameters amongst a couple of others, such as
`Unmanaged.fromOpaque`, and the source for the `move[...]` family of
methods.
2019-11-03 08:42:26 -08:00

11 lines
478 B
Swift

// RUN: %target-typecheck-verify-swift
// REQUIRES: objc_interop
func unsafePointerInitEphemeralConversions() {
class C {}
var c: C?
_ = AutoreleasingUnsafeMutablePointer(&c) // expected-warning {{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(_:)'}}
}