[Bug libstdc++/105027] Missing constraints on std::bit_cast
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Apr 4 11:47:42 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105027
--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:
https://gcc.gnu.org/g:20f2303b0ce6bbe412e852e6423daabd04c39ebb
commit r11-9773-g20f2303b0ce6bbe412e852e6423daabd04c39ebb
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Wed Mar 23 09:57:20 2022 +0000
libstdc++: Add missing constraints to std::bit_cast [PR105027]
Our std::bit_cast was relying on the compiler to check for errors inside
__builtin_bit_cast, instead of checking them as constraints. That means
std::bit_cast was not SFINAE-friendly.
This fix uses a requires-clause, so for old versions of Clang without
concepts support the function will still be unconstrained. At some point
in future we can remove the #ifdef __cpp_concepts check and rely on all
compilers having full concepts support in C++20 mode.
libstdc++-v3/ChangeLog:
PR libstdc++/105027
* include/std/bit (bit_cast): Add constraints.
* testsuite/26_numerics/bit/bit.cast/105027.cc: New test.
(cherry picked from commit 4894d69a1f37d54b6a612e58053db477ff5ba832)
More information about the Gcc-bugs
mailing list