mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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.
11 lines
478 B
Swift
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(_:)'}}
|
|
}
|