libstdc++: Remove workaround in __gnu_cxx::char_traits::move [PR89074]
authorJonathan Wakely <jwakely@redhat.com>
Thu, 7 Jul 2022 12:40:20 +0000 (13:40 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 7 Jul 2022 16:38:14 +0000 (17:38 +0100)
The front-end bug that prevented this constexpr loop from working has
been fixed since GCC 12.1 so we can remove the workaround.

libstdc++-v3/ChangeLog:

PR c++/89074
* include/bits/char_traits.h (__gnu_cxx::char_traits::move):
Remove workaround for front-end bug.

libstdc++-v3/include/bits/char_traits.h

index b856b1d..965ff29 100644 (file)
@@ -215,14 +215,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        {
          if (__s1 == __s2) // unlikely, but saves a lot of work
            return __s1;
-#if __cpp_constexpr_dynamic_alloc
-         // The overlap detection below fails due to PR c++/89074,
-         // so use a temporary buffer instead.
-         char_type* __tmp = new char_type[__n];
-         copy(__tmp, __s2, __n);
-         copy(__s1, __tmp, __n);
-         delete[] __tmp;
-#else
          const auto __end = __s2 + __n - 1;
          bool __overlap = false;
          for (std::size_t __i = 0; __i < __n - 1; ++__i)
@@ -244,7 +236,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
            }
          else
            copy(__s1, __s2, __n);
-#endif
          return __s1;
        }
 #endif