mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
There is a special-case hack to allow capture of 'this', which is implicitly [byref] for structs. At the moment, most of the cases where this hack is necessary are [auto_closure] parameters (for assertions and &&/||). Swift SVN r5047
9 lines
204 B
Swift
9 lines
204 B
Swift
// RUN: %swift -parse %s -verify
|
|
|
|
// A [byref] parameter cannot be captured.
|
|
func foo(x : [byref] Int) {
|
|
func bar() -> Int {
|
|
return x // expected-error{{cannot capture [byref] parameter 'x'}}
|
|
}
|
|
}
|