Files
swift-mirror/test/SILOptimizer/allocbox_to_stack_not_crash_ownership.swift
Michael Gottesman 43a7f3422e [allocbox-to-stack] Update for semantic sil.
rdar://29870610
2017-04-03 14:38:09 -07:00

16 lines
623 B
Swift

// RUN: %target-swift-frontend %s -emit-ir -verify -enable-sil-ownership
// Verify we don't crash on this.
// rdar://15595118
infix operator ~>
protocol Target {}
func ~> <Target, Arg0, Result>(x: inout Target, f: @escaping (_: inout Target, _: Arg0) -> Result) -> (Arg0) -> Result {
return { f(&x, $0) } // expected-error {{escaping closures can only capture inout parameters explicitly by value}}
}
func ~> (x: inout Int, f: @escaping (_: inout Int, _: Target) -> Target) -> (Target) -> Target {
return { f(&x, $0) } // expected-error {{escaping closures can only capture inout parameters explicitly by value}}
}