mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
An empty struct without a deinit gets a single bit which is used to track the struct's liveness. Previously, an empty struct with a deinit also only got a single bit. Consequently, when discarding the struct (i.e. dropping the deinit), there was no bit left to represent the struct. This resulted in a failure to track liveness for the value. rdar://126863003
20 lines
438 B
Swift
20 lines
438 B
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: %target-build-swift %s -o %t/bin
|
|
// RUN: %target-codesign %t/bin
|
|
// RUN: %target-run %t/bin 2> %t/out.txt || true
|
|
// RUN: %FileCheck %s < %t/out.txt
|
|
|
|
// REQUIRES: executable_test
|
|
|
|
struct Example: ~Copyable {
|
|
private var failureString: String { "Goodbye." }
|
|
deinit { fatalError("FATAL ERROR: \(failureString)") }
|
|
}
|
|
|
|
func doit() {
|
|
let e = Example()
|
|
// CHECK: FATAL ERROR: Goodbye.
|
|
}
|
|
|
|
doit()
|