https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93059

--- Comment #2 from fdlbxtqi <euloanty at live dot com> ---
Also find a bug of __memmove

  /*
   * A constexpr wrapper for __builtin_memmove.
   * @param __num The number of elements of type _Tp (not bytes).
   */
  template<bool _IsMove, typename _Tp>
    _GLIBCXX14_CONSTEXPR
    inline void*
    __memmove(_Tp* __dst, const _Tp* __src, size_t __num)
    {
#ifdef __cpp_lib_is_constant_evaluated
      if (std::is_constant_evaluated())
        {
          for(; __num > 0; --__num)
            {
              if constexpr (_IsMove)
                *__dst = std::move(*__src);
              else
                *__dst = *__src;
              ++__src;
              ++__dst;
            }
          return __dst;
        }
      else
#endif
        return __builtin_memmove(__dst, __src, sizeof(_Tp) * __num);
      return __dst;
    }

The last 2nd line return __dst is wrong. It should not exist.

Reply via email to