Files
swift-mirror/test/Interop/Cxx/foreign-reference/refcounted-smartpointer-errors.swift
Gabor Horvath 96ee6eaf18 [cxx-interop] Implicitly bridge annotated smart pointers to reference types
This PR introduces implicit bridging from annotated smart pointers to
reference counted objects to Swift foreign reference types. The bridging
only happens when these smart pointers are passed around by value. The
frontend only sees the Swift foreign reference types in the signature
and the actual bridging happens during SILGen when we look at the
original clang types and note that they differ significantly from the
native types.

The bridging of parameters did not quite fit into the existing structure
of bridging conversions as smart pointers are non-trivial types passed
around as addresses and existing bridging conversions were implemented
for types passed directly.

rdar://156521316
2026-01-28 12:34:21 +00:00

13 lines
1.5 KiB
Swift

// RUN: %target-typecheck-verify-swift -cxx-interoperability-mode=default -disable-availability-checking -I %swift_src_root/lib/ClangImporter/SwiftBridging -I %S%{fs-sep}Inputs -verify-additional-file %S%{fs-sep}Inputs%{fs-sep}refcounted-smartptrs.h
import RefCountedSmartPtrs
func triggerWarnings(_ a: errors.MissingToRawPtr, // @expected-error {{'MissingToRawPtr' is not a member type of enum '__ObjC.errors'}}
_ b: errors.MissingConversionFunction, // @expected-error {{'MissingConversionFunction' is not a member type of enum '__ObjC.errors'}}
_ c: errors.MultipleConversionFunctions, // @expected-error {{'MultipleConversionFunctions' is not a member type of enum '__ObjC.errors'}}
_ d: errors.WrongConversionSignature, // @expected-error {{'WrongConversionSignature' is not a member type of enum '__ObjC.errors'}}
_ e: errors.PrivateConversionFunction, // @expected-error {{'PrivateConversionFunction' is not a member type of enum '__ObjC.errors'}}
_ f: errors.NoSuitableCtor, // @expected-error {{'NoSuitableCtor' is not a member type of enum '__ObjC.errors'}}
_ g: errors.AmbiguousCtors, // @expected-error {{'AmbiguousCtors' is not a member type of enum '__ObjC.errors'}}
_ h: errors.MismatchingPointerTypes) { // @expected-error {{'MismatchingPointerTypes' is not a member type of enum '__ObjC.errors'}}
}