https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89074
--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-10 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:0d566335a31722f8044852d9a24f492830ae5789 commit r10-10381-g0d566335a31722f8044852d9a24f492830ae5789 Author: Jonathan Wakely <jwak...@redhat.com> Date: Thu Nov 18 12:39:20 2021 +0000 libstdc++: Fix std::char_traits<C>::move for constexpr The constexpr branch in __gnu_cxx::char_traits::move compares the string arguments to see if they overlap, but relational comparisons between unrelated pointers are not core constant expressions. I want to replace the comparisons with a loop using pointer equality to determine whether the end of the source string is in the destination string. However, that doesn't work with GCC, due to PR c++/89074 so allocate a temporary buffer instead and copy out into that first, so that overlapping source and destination don't matter. The allocation isn't supported by the current Intel icc so use the loop as a fallback. libstdc++-v3/ChangeLog: * include/bits/char_traits.h (__gnu_cxx::char_traits::move): Do not compare unrelated pointers during constant evaluation. * testsuite/21_strings/char_traits/requirements/constexpr_functions_c++20.cc: Improve tests for char_traits::move. (cherry picked from commit ca243ada71656651a8753e88164a1f0f019be1c3)