https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99637
Jan Schultke <janschultke at googlemail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |janschultke at googlemail dot
com
--- Comment #9 from Jan Schultke <janschultke at googlemail dot com> ---
This is more of a wording defect and design problem than an issue with GCC. The
minimal repro for the GCC/Clang divergence is:
// GCC OK, Clang error
constexpr auto x = __builtin_bit_cast(__int128, 0.0L);
Surprisingly, BOTH compilers are correct because
https://eel.is/c++draft/bit.cast#4.2 makes this case undefined behavior, and we
don't explicitly require UB to disqualify constant expressions here. Library UB
does not have to be diagnosed.
The original example of casting a 63-bit type with one padding bit to unsigned
long long is equivalent.
I am working on a paper that deals with the std::bit_cast padding issues:
https://isocpp.org/files/papers/D3969R0.html