|
|
| Previous ID |
SR-9043 |
| Radar |
rdar://problem/45511834 |
| Original Reporter |
koher (JIRA User) |
| Type |
Bug |
| Status |
Resolved |
| Resolution |
Done |
Environment
Xcode Version 10.0 (10A255)
Additional Detail from JIRA
|
|
| Votes |
1 |
| Component/s |
Compiler |
| Labels |
Bug, CompilerCrash, TypeChecker |
| Assignee |
@slavapestov |
| Priority |
Medium |
md5: 23f0e6aa3983c486dcd3930dc0b1232d
relates to:
- SR-8546 Enforce @escaping for for all but the most trivial uses of captured variables.
Issue Description:
The following code causes a compile-time error correctly.
func run(_ body: @escaping () -> Void) { body() }
struct S {
var a: Int = 3
mutating func foo() {
func _foo() {
if a == 0 { return }
a -= 1
print(a)
run(_foo)
}
_foo()
}
}
var s = S()
s.foo()
error: nested function with an implicitly captured inout parameter can only be used as a non-escaping argument
run(_foo)
^
However, when `run(_foo)` is changed to `run { _foo() }`, it can be compiled. I guess the compiler lacks some checks.
Environment
Xcode Version 10.0 (10A255)
Additional Detail from JIRA
md5: 23f0e6aa3983c486dcd3930dc0b1232d
relates to:
Issue Description:
The following code causes a compile-time error correctly.
However, when `run(_foo)` is changed to `run { _foo() }`, it can be compiled. I guess the compiler lacks some checks.