mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
This test fused both the CHECK directives and the source code into one file, and is sensitive to the line numbers that source code appears on in that file. Thus, any attempts to add new lines to this test would break it. This refactoring moves the source code to a separate file so its line numbers stay stable.
28 lines
300 B
Swift
28 lines
300 B
Swift
func level1() {
|
|
level2()
|
|
}
|
|
|
|
func level2() {
|
|
level3()
|
|
}
|
|
|
|
func level3() {
|
|
level4()
|
|
}
|
|
|
|
func level4() {
|
|
level5()
|
|
}
|
|
|
|
func level5() {
|
|
print("About to crash")
|
|
let ptr = UnsafeMutablePointer<Int>(bitPattern: 4)!
|
|
ptr.pointee = 42
|
|
}
|
|
|
|
@main
|
|
struct Crash {
|
|
static func main() {
|
|
level1()
|
|
}
|
|
} |