Files
swift-mirror/test/expr/capture/byref.swift
Doug Gregor 7c2f86d948 Prohibit capture of [byref] parameters.
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
2013-05-06 14:54:22 +00:00

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'}}
}
}