This is a partial backport of r14-6064-gc3f281a0c1ca50 which replaced a
use of __is_trivially_copyable in the requires-clause for std::bit_cast.
The change isn't actually necessary on the gcc-13 and gcc-12 branches,
but in gcc-14 using the built-in directly because ill-formed because we
started to mangle requires-clauses.

Replacing the built-in with the equivalent library trait makes it easier
to do bisections with preprocessed source created by GCC 13, because the
built-in won't cause errors with gcc-14 and later.

libstdc++-v3/ChangeLog:

        * include/std/bit (bit_cast): Use library trait instead of
        __is_trivially_copyable built-in.
---

I had to edit preprocessed source a few times over the past week to
workaround this, so I decided to just change it on the gcc-13 branch.

The r14-6064-gc3f281a0c1ca50 commit also made similar changes to the
~_Variant_union destructor in <variant> but backporting that to gcc-13
caused 20_util/variant/87619.cc to FAIL, due to exceeding the template
instantiation depth. I think that was fixed by r14-7259-g2d55d94e5df389
so we would need to backport that too.

Tested x86_64-linux, pushed to gcc-13.

 libstdc++-v3/include/std/bit | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit
index 5eb40218be9..03a2938b493 100644
--- a/libstdc++-v3/include/std/bit
+++ b/libstdc++-v3/include/std/bit
@@ -81,7 +81,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     bit_cast(const _From& __from) noexcept
 #ifdef __cpp_concepts
     requires (sizeof(_To) == sizeof(_From))
-      && __is_trivially_copyable(_To) && __is_trivially_copyable(_From)
+      && is_trivially_copyable_v<_To> && is_trivially_copyable_v<_From>
 #endif
     {
       return __builtin_bit_cast(_To, __from);
-- 
2.49.0

Reply via email to