Files
swift-mirror/test/Interop/Cxx/class/inheritance/using-base-members-module-interface.swift
Egor Zhdan efc008a2ca [cxx-interop] Import using decls that expose methods from private base classes
If a C++ type `Derived` inherits from `Base` privately, the public methods from `Base` should not be callable on an instance of `Derived`. However, C++ supports exposing such methods via a using declaration: `using MyPrivateBase::myPublicMethod;`.

MSVC started using this feature for `std::optional` which means Swift doesn't correctly import `var pointee: Pointee` for instantiations of `std::optional` on Windows. This prevents the automatic conformance to `CxxOptional` from being synthesized.

 rdar://114282353 / resolves https://github.com/apple/swift/issues/68068
2023-11-14 00:30:54 +00:00

34 lines
1.1 KiB
Swift

// RUN: %target-swift-ide-test -print-module -module-to-print=UsingBaseMembers -I %S/Inputs -source-filename=x -cxx-interoperability-mode=upcoming-swift | %FileCheck %s
// CHECK: struct PublicBase {
// CHECK-NEXT: init()
// CHECK-NEXT: func publicGetter() -> Int32
// CHECK-NEXT: mutating func publicSetter(_ v: Int32)
// CHECK-NEXT: func notExposed()
// CHECK-NEXT: }
// CHECK: struct PublicBasePrivateInheritance {
// CHECK-NEXT: init()
// CHECK-NEXT: func publicGetter() -> Int32
// CHECK-NEXT: mutating func publicSetter(_ v: Int32)
// CHECK-NEXT: }
// CHECK: struct PublicBaseProtectedInheritance {
// CHECK-NEXT: init()
// CHECK-NEXT: func publicGetter() -> Int32
// CHECK-NEXT: mutating func publicSetter(_ v: Int32)
// CHECK-NEXT: }
// CHECK: struct UsingBaseConstructorWithParam {
// CHECK-NEXT: init(_: IntBox)
// CHECK-NEXT: init(_: UInt32)
// CHECK-NEXT: init(_: Int32)
// CHECK-NEXT: var value: Int32
// CHECK-NEXT: }
// CHECK: struct UsingBaseConstructorEmpty {
// CHECK-NEXT: init()
// CHECK-NEXT: init(_: Empty)
// CHECK-NEXT: var value: Int32
// CHECK-NEXT: }