Skip to content

Commit 865dc0c

Browse files
authored
Merge pull request swiftlang#21746 from slavapestov/inout-closure-regression-test
Sema: Add a couple of inout-vs-closures regression tests
2 parents 62c4036 + b05e52b commit 865dc0c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/Constraints/closures.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,3 +858,19 @@ func rdar45771997() {
858858
let _: Int = { (s: inout S) in s.foo() }
859859
// expected-error@-1 {{cannot convert value of type '(inout S) -> ()' to specified type 'Int'}}
860860
}
861+
862+
struct rdar30347997 {
863+
func withUnsafeMutableBufferPointer(body : (inout Int) -> ()) {}
864+
func foo() {
865+
withUnsafeMutableBufferPointer {
866+
(b : Int) in // expected-error {{'Int' is not convertible to 'inout Int'}}
867+
}
868+
}
869+
}
870+
871+
struct rdar43866352<Options> {
872+
func foo() {
873+
let callback: (inout Options) -> Void
874+
callback = { (options: Options) in } // expected-error {{cannot assign value of type '(inout Options) -> ()' to type '(inout _) -> Void'}}
875+
}
876+
}

0 commit comments

Comments
 (0)