// RUN: %target-typecheck-verify-swift func takesAutoclosure(_ lhs: T, _ rhs: @autoclosure () throws -> T) {} func test( _ rawPtr: UnsafeRawPointer, _ mutRawPtr: UnsafeMutableRawPointer, _ mutPtr: UnsafeMutablePointer, _ ptr: UnsafePointer, _ ptrI8: UnsafePointer, _ ptrU8: UnsafePointer, _ ptrVoid: UnsafePointer // expected-warning {{UnsafePointer has been replaced by UnsafeRawPointer}} ) { var i: Int = 0 var a: [Int] = [0] let s = "string" takesAutoclosure(rawPtr, &i) // expected-error {{'&' used with non-inout argument of type 'Int'}} takesAutoclosure(mutRawPtr, &i) // expected-error {{'&' used with non-inout argument of type 'Int'}} takesAutoclosure(mutPtr, &i) // expected-error {{'&' used with non-inout argument of type 'Int'}} takesAutoclosure(ptr, &i) // expected-error {{'&' used with non-inout argument of type 'Int'}} takesAutoclosure(rawPtr, &a) // expected-error {{'&' used with non-inout argument of type '[Int]'}} takesAutoclosure(mutRawPtr, &a) // expected-error {{'&' used with non-inout argument of type '[Int]'}} takesAutoclosure(mutPtr, &a) // expected-error {{'&' used with non-inout argument of type '[Int]'}} takesAutoclosure(ptr, &a) // expected-error {{'&' used with non-inout argument of type '[Int]'}} takesAutoclosure(rawPtr, a) // expected-error {{cannot invoke 'takesAutoclosure' with an argument list of type '(UnsafeRawPointer, [Int])'}} // expected-note@-1 {{expected an argument list of type '(T, @autoclosure () throws -> T)'}} takesAutoclosure(ptr, a) // expected-error {{cannot invoke 'takesAutoclosure' with an argument list of type '(UnsafePointer, [Int])'}} // expected-note@-1 {{expected an argument list of type '(T, @autoclosure () throws -> T)'}} takesAutoclosure(rawPtr, s) // expected-error {{cannot invoke 'takesAutoclosure' with an argument list of type '(UnsafeRawPointer, String)'}} // expected-note@-1 {{expected an argument list of type '(T, @autoclosure () throws -> T)'}} takesAutoclosure(ptrI8, s) // expected-error {{cannot invoke 'takesAutoclosure' with an argument list of type '(UnsafePointer, String)'}} // expected-note@-1 {{expected an argument list of type '(T, @autoclosure () throws -> T)'}} takesAutoclosure(ptrU8, s) // expected-error {{cannot invoke 'takesAutoclosure' with an argument list of type '(UnsafePointer, String)'}} // expected-note@-1 {{expected an argument list of type '(T, @autoclosure () throws -> T)'}} takesAutoclosure(ptrVoid, s) // expected-error {{cannot invoke 'takesAutoclosure' with an argument list of type '(UnsafePointer, String)'}} // expected-note@-1 {{expected an argument list of type '(T, @autoclosure () throws -> T)'}} }