mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
17 lines
317 B
Swift
17 lines
317 B
Swift
// RUN: %target-typecheck-verify-swift
|
|
|
|
// An inout parameter can be captured.
|
|
func foo(x: inout Int) {
|
|
func bar() -> Int {
|
|
return x
|
|
}
|
|
}
|
|
|
|
// But not partially applied.
|
|
struct C {
|
|
mutating func f(x: Int) {}
|
|
}
|
|
|
|
var c = C()
|
|
let x = c.f // expected-error{{cannot reference 'mutating' method as function value}}
|