In some cases (When enabling objc and C++ Interop with -enable-cxx-interop -enable-objc-interop) it can be possible to cause the swift compiler to crash on clang import when using operator==. The repro is below, but it is worth noting that there is no crash if either the `let eq = (a == b)` line is removed or if the `import Foundation` line is removed. If either are removed there is simply a compile error (most likely because the types for the rhs are currently `rhs: UnsafePointer\<S>` while the type or the lhs is `inout S`.
<unknown>:0: error: fatal error encountered while reading from module 'Foundation';
*** DESERIALIZATION FAILURE (please include this section in any bug report) *** could not deserialize type for 'ReferenceConvertible': result is ambiguous Cross-reference to module 'ObjectiveC' ... NSObject
...
abort + 104
swift::ModuleFileSharedCore::~ModuleFileSharedCore() + 0
swift::ModuleFile::readParameterList() + 0
It is also worth noting that before the crash there is a lengthy compile error as well, but it is not related to the inout versus UnsafePointer issue:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.5.sdk/usr/include/c++/v1/memory:1603:25: error: no member named 'select_on_container_copy_construction' in 'std::__1::allocator<char>'
Also, here's the output of the ide tool for the above C++ header:
Additional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Sub-task, CxxInterop | |Assignee | None | |Priority | Medium | md5: f98f95ad8507497363af125ad59fbc18Parent-Task:
57304
Issue Description:
In some cases (When enabling objc and C++ Interop with -enable-cxx-interop -enable-objc-interop) it can be possible to cause the swift compiler to crash on clang import when using operator==. The repro is below, but it is worth noting that there is no crash if either the `let eq = (a == b)` line is removed or if the `import Foundation` line is removed. If either are removed there is simply a compile error (most likely because the types for the rhs are currently `rhs: UnsafePointer\<S>` while the type or the lhs is `inout S`.
C++ (header):
Swift:
Module Map:
Stack Trace:
It is also worth noting that before the crash there is a lengthy compile error as well, but it is not related to the inout versus UnsafePointer issue:
Also, here's the output of the ide tool for the above C++ header:
Command Line (module map and header file are in include dir):