You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue contains a list of all known limitations and other issues related to C++ interoperability support in the Swift 5.9 release of Swift. Not known issues are not listed here, so if you see something please report a new issue.
Note: Swift 5.9 is still undergoing development, and therefore some limitations and issues listed here will be fixed before Swift 5.9 is release. Please see the following tracking issue you'd like to see which issues we plan on fixing in Swift 5.9.
Issues Related to Using C++ APIs in Swift 5.9
Some functions or member functions whose return type is not yet available in Swift, or not exported by the Clang module could appear to be available and callable from Swift, with the Never return type. Such functions should not be available in Swift, and should not be called : #64401 .
Default arguments in C++ functions are not mapped to default arguments in Swift functions or methods.
Functions inside inline namespaces must be accessed using the inline namespace qualifier from Swift due to: #58217 .
Issues Related to C++ Member Functions
C++ constant member functions that mutate the object using a mutable field cannot be annotated with SWIFT_MUTATING. This means that the user has no way to import it as mutating Swift method, and as such such member functions should generally not be called in Swift. This issue tracks the addition of SWIFT_MUTATING macro to the <swift/bridging> header: #66322.
Specifically on the Windows deployment platform, some member functions might be dispatched incorrectly: #66326
Issues Related to Accessing Inherited Members
Swift compiler might introduce ambiguous method overloads when adding a C++ member from a base a C++ class to the Swift type that represents the C++ class or structure. This issue tracks the clarification of related rules which should resolve the problem, and gives an example of when such issue might occur: #66323
Issues Related to C or Objective-C compatibility
Objective-C options sets, like NSTrackingArea import incorrectly when C++ interoperability is enabled: #65885
Use of some Objective-C Foundation functions, like URL.bookmark() might lead to linking errors: #66501
A trivial C++ structure or class that has only Objective-C ARC object pointers as fields can be incorrectly passed to an Objective-C method call when C++ interop is enabled (on Intel): #61929 .
On Linux, you cannot import Foundation when C++ interop is enabled: #64457
Known Compiler Crashes In Swift Related to C++ Interoperability
Swift functions and methods are exposed to C++ using just their base name, and argument labels aren't factored into the C++ function name. Only one function / method with the same base name and same number of parameters is exposed to C++. For example, given the following two functions:
Issues Related to Using Swift Structures or Enumerations in C++
Swift structures and enumerations currently can't use the copy-assignment operator in C++, i.e. they can't be reassigned after they're initialized: #66324.
Swift structures and enumerations cannot be moved in C++. That is, you can't use std::move on a Swift structure or enumeration to move a value to a new value using a move constructor or a move assignment operator.
Issues Related to Using Swift Generics in C++
Swift generic structure or enumeration might fail to work with the Swift Int type as a generic type parameter in C++: #63452 .
Issues Related to Swift Package Manager Support For C++ Interoperability
This issue contains a list of all known limitations and other issues related to C++ interoperability support in the Swift 5.9 release of Swift. Not known issues are not listed here, so if you see something please report a new issue.
Note: Swift 5.9 is still undergoing development, and therefore some limitations and issues listed here will be fixed before Swift 5.9 is release. Please see the following tracking issue you'd like to see which issues we plan on fixing in Swift 5.9.
Issues Related to Using C++ APIs in Swift 5.9
Some functions or member functions whose return type is not yet available in Swift, or not exported by the Clang module could appear to be available and callable from Swift, with the
Never
return type. Such functions should not be available in Swift, and should not be called : #64401 .Default arguments in C++ functions are not mapped to default arguments in Swift functions or methods.
Functions inside inline namespaces must be accessed using the inline namespace qualifier from Swift due to: #58217 .
Issues Related to C++ Member Functions
C++ constant member functions that mutate the object using a
mutable
field cannot be annotated withSWIFT_MUTATING
. This means that the user has no way to import it asmutating
Swift method, and as such such member functions should generally not be called in Swift. This issue tracks the addition ofSWIFT_MUTATING
macro to the<swift/bridging>
header: #66322.Specifically on the Windows deployment platform, some member functions might be dispatched incorrectly: #66326
Issues Related to Accessing Inherited Members
Swift compiler might introduce ambiguous method overloads when adding a C++ member from a base a C++ class to the Swift type that represents the C++ class or structure. This issue tracks the clarification of related rules which should resolve the problem, and gives an example of when such issue might occur: #66323
Issues Related to C or Objective-C compatibility
Objective-C options sets, like
NSTrackingArea
import incorrectly when C++ interoperability is enabled: #65885Use of some Objective-C Foundation functions, like
URL.bookmark()
might lead to linking errors: #66501A trivial C++ structure or class that has only Objective-C ARC object pointers as fields can be incorrectly passed to an Objective-C method call when C++ interop is enabled (on Intel): #61929 .
On Linux, you cannot import Foundation when C++ interop is enabled: #64457
Known Compiler Crashes In Swift Related to C++ Interoperability
Issues Related to Using Swift APIs in C++
Swift functions and methods are exposed to C++ using just their base name, and argument labels aren't factored into the C++ function name. Only one function / method with the same base name and same number of parameters is exposed to C++. For example, given the following two functions:
Only one of them is available in C++.
Issues Related to Using Swift Structures or Enumerations in C++
Swift structures and enumerations currently can't use the copy-assignment operator in C++, i.e. they can't be reassigned after they're initialized: #66324.
Swift structures and enumerations cannot be moved in C++. That is, you can't use
std::move
on a Swift structure or enumeration to move a value to a new value using a move constructor or a move assignment operator.Issues Related to Using Swift Generics in C++
Swift generic structure or enumeration might fail to work with the Swift
Int
type as a generic type parameter in C++: #63452 .Issues Related to Swift Package Manager Support For C++ Interoperability
Issues Related to IDE Support
Code-completion for C++ namespace members in Swift is not yet supported: #65736 .
The text was updated successfully, but these errors were encountered: