Files
swift-mirror/test/Interop/Cxx/foreign-reference/unmanaged.swift
Egor Zhdan 069c42159f [cxx-interop] Relax a SILVerifier assertion for immortal reference types
Immortal C++ foreign reference types get TrivialTypeLowering instead of ReferenceTypeLowering, since they do not have retain/release lifetime operations. This was tripping up an assertion in SILVerifier.

rdar://147251759 / resolves https://github.com/swiftlang/swift/issues/80065
(cherry picked from commit 2e3df1c0f3)
2025-05-21 13:06:01 +01:00

21 lines
469 B
Swift

// RUN: %target-run-simple-swift(-I %S/Inputs -cxx-interoperability-mode=default -Xfrontend -disable-availability-checking) | %FileCheck %s
// REQUIRES: executable_test
import POD
extension Empty {
public static func == (lhs: Empty, rhs: Empty) -> Bool {
Unmanaged.passUnretained(lhs).toOpaque() == Unmanaged.passUnretained(rhs).toOpaque()
}
}
let x = Empty.create()
let y = Empty.create()
print(x == y)
// CHECK: false
print(x == x)
// CHECK: true