This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Use _GLIBCXX_NOEXCEPT_IF for std::swap


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?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]