Files
swift-mirror/test/SILGen/memberwise_init_temporary_allocations.swift
Joe Groff ffbfcfa131 SILGen: Extend scope for evaluation in memberwise initializers to include initializer expressions.
Catch any cleanups that get emitted while evaluating the initializer expression for a property.
Fixes rdar://problem/63187509.
2020-05-15 14:53:32 -07:00

19 lines
463 B
Swift

// RUN: %target-swift-emit-silgen -verify %s
protocol P { var x: Int { get } }
extension Int: P { var x: Int { return self } }
// rdar://problem/63187509: Evaluating the variable initializer for `px`
// requires allocating a temporary stack slot for the address only value of
// `Butt.p`. Ensure that this gets cleaned up appropriately (which is asserted
// by the SIL verifier).
struct Butt {
static var p: P = 0
let px = Butt.p.x
let y: Int
}