https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114821
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- If the problem is simply that the __restrict qualifiers are not present because we go through the generic function taking iterators, then we can just add: --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -1109,8 +1109,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template <typename _Tp, typename _Up> _GLIBCXX20_CONSTEXPR inline __enable_if_t<std::__is_bitwise_relocatable<_Tp>::value, _Tp*> - __relocate_a_1(_Tp* __first, _Tp* __last, - _Tp* __result, + __relocate_a_1(_Tp* __restrict __first, _Tp* __last, + _Tp* __restrict __result, [[__maybe_unused__]] allocator<_Up>& __alloc) noexcept { ptrdiff_t __count = __last - __first; @@ -1147,6 +1147,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::__niter_base(__result), __alloc); } + template <typename _Tp, typename _Up> + _GLIBCXX20_CONSTEXPR + inline _ForwardIterator + __relocate_a(_Tp* __restrict __first, _Tp* __last, + _Tp* __restrict __result, + [[__maybe_unused__]] allocator<_Up>& __alloc) noexcept + noexcept(std::__is_bitwise_relocatable<_Tp>::value) + { + return std::__relocate_a_1(__first, __last, __result, __alloc); + } + /// @endcond #endif // C++11 If the problem is that std::pair<int, int> is not bitwise_relocatable, then we could change that (as Marc suggested as a possible future enhancement): --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -1082,6 +1082,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct __is_bitwise_relocatable : is_trivial<_Tp> { }; + template<typename _Tp, typename _Up> + struct __is_bitwise_relocatable<pair<_Tp, _Up>, void> + : __and_<is_trivial<_Tp>, is_trivial<_Up>> + { }; + template <typename _InputIterator, typename _ForwardIterator, typename _Allocator> _GLIBCXX20_CONSTEXPR