https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117727
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed| |2024-11-21
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
C++20 testcase not using __builtin_ directly so it can be tested with other
compilers:
```
#include <bit>
typedef decltype(sizeof(0)) uintptr_t;
constexpr uintptr_t A = std::bit_cast<uintptr_t>(nullptr);
static_assert(A == 0);
typedef decltype(nullptr) nullptr_t;
constexpr decltype(nullptr) N = std::bit_cast<nullptr_t>((uintptr_t)12);
static_assert(N == nullptr);
```
MSVC only says the last static_assert fails and accepts the first one.
clang rejects the first static_assert as being non-constant while the second
static_assert works (similar to how Jakub describes how he thinks it should
work).
So in summary all 3 compilers have different behavior.