-
Notifications
You must be signed in to change notification settings - Fork 12k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSVC Compatibility: Implement intrinsics for P0466R5 - Layout-compatibility and Pointer-interconvertibility Traits #48204
Comments
Do we know why MSVC has deviated from the longstanding rule that compiler intrinsic forms of type traits are named by prefixing simply In particular, if MSVC is avoiding name collisions with something, will we need to avoid adding the normal name in addition to the |
Agree and thanks for catching this. In the past we've used the |
Update: The C++ toolset update renaming the intrinsics (removing the MSVC STL moved to the new names as well: https://github.com/microsoft/STL/pull/1711/files |
With the latest MSVC update, the intrinsic names are:
|
GCC also does this. It would be great to implement this in Clang so that libc++ can start using the traits. |
@MahmoudGSaleh how should |
This patch implements `__is_layout_compatible` intrinsic, which supports `std::is_layout_compatible` type trait introduced in C++20 ([P0466R5](https://wg21.link/p0466r5) "Layout-compatibility and Pointer-interconvertibility Traits"). Name matches GCC and MSVC intrinsic. Basically, this patch exposes our existing machinery for checking for layout compatibility and figuring out common initial sequences. Said machinery is a bit outdated, as it doesn't implement [CWG1719](https://cplusplus.github.io/CWG/issues/1719.html) "Layout compatibility and cv-qualification revisited" and [CWG2759](https://cplusplus.github.io/CWG/issues/2759.html) "`[[no_unique_address]` and common initial sequence". Those defect reports are considered out of scope of of this PR, but will be implemented in subsequent PRs. Partially addresses #48204
Extended Description
MSVC recently implemented the following intrinsics needed for P0466R5 Layout-compatibility and Pointer-interconvertibility Traits:
__builtin_is_layout_compatible
__builtin_is_pointer_interconvertible_base_of
__builtin_is_pointer_interconvertible_with_class
__builtin_is_corresponding_member
MSVC STL is planning to use them in
<type_traits>
as follows (PR: microsoft/STL#1575):The text was updated successfully, but these errors were encountered: