Skip to content

Commit 1c592a7

Browse files
committed
The fix for 23433271 also fixed the crash on 22058555, add its testcase so
we don't regress on it in the future. Yes, the diagnostic is lousy, I'll repurpose the second radar to improve it.
1 parent f4fc002 commit 1c592a7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

test/Constraints/diagnostics.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,5 +641,11 @@ func segfault23433271(a : UnsafeMutablePointer<Void>) {
641641
f23433271(a[0]) // expected-error {{cannot subscript a value of type 'UnsafeMutablePointer<Void>' (aka 'UnsafeMutablePointer<()>')}}
642642
}
643643

644-
644+
// <rdar://problem/22058555> crash in cs diags in withCString
645+
func r22058555() {
646+
var firstChar: UInt8 = 0
647+
"abc".withCString { chars in
648+
firstChar = chars[0] // expected-error {{cannot subscript a value of type 'UnsafePointer<Int8>'}}
649+
}
650+
}
645651

0 commit comments

Comments
 (0)