Files
swift-mirror/test/Interop/Cxx/foreign-reference/print-reference.swift
Egor Zhdan b440c4ff70 [cxx-interop] Enable reference-counted types on Windows
This enables the use of reference-counted foreign reference types on Windows. As it turns out, the assertion that was failing on Windows previously was unnecessary. This also enabled many of the tests on Windows.

rdar://154694125 / resolves https://github.com/swiftlang/swift/issues/82643
2025-08-20 12:35:10 +01:00

53 lines
1.2 KiB
Swift

// RUN: %target-run-simple-swift(-cxx-interoperability-mode=default -I %S/Inputs) | %FileCheck %s
// REQUIRES: executable_test
// Temporarily disable when running with an older runtime (rdar://153205860)
// UNSUPPORTED: use_os_stdlib
// UNSUPPORTED: back_deployment_runtime
import Printed
func printCxxImmortalFRT() {
if #available(SwiftStdlib 6.2, *) {
let s = ImmortalFRT()
print(s)
} else {
print("runtime too old")
}
}
@available(SwiftStdlib 5.9, *)
extension FRTCustomStringConvertible : CustomStringConvertible {
public var description: String {
return "FRTCustomStringConvertible(publ: \(publ))"
}
}
func printCxxFRTCustomStringConvertible() {
if #available(SwiftStdlib 5.9, *) {
let s = FRTCustomStringConvertible()
print(s)
} else {
print("runtime too old")
}
}
func printCxxFRType() {
if #available(SwiftStdlib 6.2, *) {
let s = FRType()
print(s)
} else {
print("runtime too old")
}
}
printCxxImmortalFRT()
// CHECK: {{ImmortalFRT()|runtime too old}}
printCxxFRTCustomStringConvertible()
// CHECK: FRTCustomStringConvertible(publ: 2)
printCxxFRType()
// CHECK: {{FRType()|runtime too old}}