Files
swift-mirror/test/Interop/Cxx/class/inheritance/virtual-methods-module-interface.swift
Egor Zhdan 325868808b [cxx-interop] Do not import constructors of abstract C++ classes
Clang rejects code that tries to call a constructor of an abstract C++ class with an error: "Variable type 'Base' is an abstract class". Swift should reject this as well.

rdar://119689243
2023-12-18 14:52:32 +00:00

26 lines
853 B
Swift

// RUN: %target-swift-ide-test -print-module -print-implicit-attrs -module-to-print=VirtualMethods -I %S/Inputs -source-filename=x -enable-experimental-cxx-interop | %FileCheck %s
// CHECK: struct Base {
// CHECK-NEXT: @available(*, unavailable, message: "constructors of abstract C++ classes are unavailable in Swift")
// CHECK-NEXT: init()
// CHECK-NEXT: @available(*, unavailable, message: "virtual function is not available in Swift because it is pure")
// CHECK-NEXT: mutating func foo()
// CHECK: }
// CHECK: struct Base3 {
// CHECK-NEXT: init()
// CHECK: }
// CHECK: struct Derived2 {
// CHECK-NEXT: init()
// CHECK: }
// CHECK: struct Derived<CInt> {
// CHECK-NEXT: init()
// CHECK-NEXT: mutating func foo()
// CHECK: }
// CHECK: struct VirtualNonAbstractBase {
// CHECK-NEXT: init()
// CHECK-NEXT: func nonAbstractMethod()