mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
If the operand is an address, we need to use `destroy_addr` and not `destroy_value`. Fixes a compiler crash. rdar://144662171
22 lines
521 B
Swift
22 lines
521 B
Swift
// RUN: %target-swift-frontend -primary-file %s -enable-library-evolution -emit-sil | %FileCheck %s
|
|
|
|
public enum E: Hashable {
|
|
case e
|
|
}
|
|
|
|
public struct S {
|
|
public var dict: [E: Int] = [:]
|
|
}
|
|
|
|
// Check that the keypath simplification does not crash when inserting a compensating destroy.
|
|
|
|
// CHECK-LABEL: sil @$s26simplify_keypath_resilient6testityyF :
|
|
// CHECK-NOT: keypath
|
|
// CHECK: } // end sil function '$s26simplify_keypath_resilient6testityyF'
|
|
@inlinable
|
|
public func testit() {
|
|
let _ = \S.dict[.e]
|
|
}
|
|
|
|
|