Files
swift-mirror/test/DebugInfo/moveonly_enum_inline.swift
Emil Pedersen ec8d15df2e [SILBuilder] Fix inlining of move-only structs in debug blocks
Force ownership off for struct/enum of move-only types in debug
reconstruction blocks within SILBuilder, so that the SILCloner doesn't
create debug_values with ownership issues.
2026-06-26 17:10:19 +01:00

22 lines
570 B
Swift

// RUN: %target-swift-frontend -emit-sil %s -g -O -module-name a
// Make sure inlining a function with a move-only optional does not crash
// due to forwardToInit forcing owned ownership in debug reconstruction blocks.
// TODO: investigate why all debug values end up being undef.
struct TrivialMoveOnly: ~Copyable {
var payload: Int
}
func someFunction() {
let instance = TrivialMoveOnly(payload: 100)
let container: TrivialMoveOnly? = instance
if case .some(let boundValue) = container {
let _ = boundValue.payload
}
}
someFunction()