-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Closed
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++Feature: Interoperability with C++c++ to swiftFeature → c++ interop: c++ to swiftFeature → c++ interop: c++ to swiftclang importerArea → compiler: The clang importerArea → compiler: The clang importercompilerThe Swift compiler itselfThe Swift compiler itselfswift 5.10unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output
Description
Description
I'm facing an issue with C++ interoperability when trying to use a class that comes from C++ in Swift due to importing a pointer to pointer as ?!
instead of unsafe pointers, which makes some C++ code impossible to use.
More context on this swift forum post.
Reproduction
#include <swift/bridging>
class DB {
public:
void openDB(DB**);
} SWIFT_UNSAFE_REFERENCE;
is imported as
@available(macOS 13.3.0, *)
public class DB {
public func openDB(_: DB?!)
}
Expected behavior
That the API is imported using unsafe pointers so that I can do this:
var db: DB = nil
openDB(&db)
Environment
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
(I also tried with a 5.10 snapshot from Dec 19 with the same result).
Additional information
No response
Metadata
Metadata
Assignees
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.A deviation from expected or documented behavior. Also: expected but undesirable behavior.c++ interopFeature: Interoperability with C++Feature: Interoperability with C++c++ to swiftFeature → c++ interop: c++ to swiftFeature → c++ interop: c++ to swiftclang importerArea → compiler: The clang importerArea → compiler: The clang importercompilerThe Swift compiler itselfThe Swift compiler itselfswift 5.10unexpected behaviorBug: Unexpected behavior or incorrect outputBug: Unexpected behavior or incorrect output