[PATCH] Use _GLIBCXX_NOEXCEPT_IF for std::swap
Stephan Bergmann
sbergman@redhat.com
Thu May 2 18:34:00 GMT 2019
On 29/04/2019 15:26, Jonathan Wakely wrote:
> Â Â Â Â * include/bits/move.h (swap(T&, T&), swap(T (&)[N], T (&)[N])): Use
> Â Â Â Â _GLIBCXX_NOEXCEPT_IF to simplify declarations.
>
> This just avoids having to repeat the name and parameter-list of the
> functions.
libstdc++-v3/include/std/type_traits still has
> template<typename _Tp>
> inline
> typename enable_if<__and_<__not_<__is_tuple_like<_Tp>>,
> is_move_constructible<_Tp>,
> is_move_assignable<_Tp>>::value>::type
> swap(_Tp&, _Tp&)
> noexcept(__and_<is_nothrow_move_constructible<_Tp>,
> is_nothrow_move_assignable<_Tp>>::value);
using noexcept instead of _GLIBCXX_NOEXPECT_IF, and at least during
configure of building LibreOffice with Clang, that causes failure
> .../gcc/trunk/lib/gcc/x86_64-pc-linux-gnu/10.0.0/../../../../include/c++/10.0.0/bits/move.h:185:5: error: exception specification in declaration does not match previous declaration
> swap(_Tp& __a, _Tp& __b)
> ^
> .../gcc/trunk/lib/gcc/x86_64-pc-linux-gnu/10.0.0/../../../../include/c++/10.0.0/type_traits:2531:5: note: previous declaration is here
> swap(_Tp&, _Tp&)
> ^
I didn't try to track down under what conditions _GLIBCXX_NOEXCEPT_IF
would not expand to noexcept, but I assume that just type_traits needs
adapting, too?
More information about the Libstdc++
mailing list