mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
If the LLVM size of a type doesn't match its stride, or a type's size is dynamic, we can't naively lower index_addr to a GEP of the LLVM pointer. We have to bitcast to i8* and GEP the strided distance in bytes. Fixes <rdar://problem/15609900>. Swift SVN r10972
28 lines
402 B
Swift
28 lines
402 B
Swift
// RUN: %swift -i %s | FileCheck %s
|
|
// REQUIRES: swift_interpreter
|
|
|
|
// <rdar://problem/15609900>
|
|
|
|
// CHECK: 10
|
|
// CHECK: None
|
|
// CHECK: 20
|
|
// CHECK: None
|
|
// CHECK: 30
|
|
// CHECK: hello world
|
|
func main() {
|
|
var arrOpt : (Int?)[] = [10,.None,20,.None,30]
|
|
for item in arrOpt {
|
|
switch item {
|
|
case .None:
|
|
println("None")
|
|
case .Some(var v):
|
|
println(v)
|
|
}
|
|
}
|
|
println("hello world")
|
|
}
|
|
|
|
main()
|
|
|
|
|