This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] Use _GLIBCXX_NOEXCEPT_IF for std::swap
- From: Stephan Bergmann <sbergman at redhat dot com>
- To: libstdc++ at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Cc: Jonathan Wakely <jwakely at redhat dot com>
- Date: Thu, 2 May 2019 20:34:15 +0200
- Subject: Re: [PATCH] Use _GLIBCXX_NOEXCEPT_IF for std::swap
- References: <20190429132622.GA17394@redhat.com>
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?