libstdc++: Make filesystem::path(path&&) always noexcept

Since r12-4065 std::basic_string is always nothrow-move-constructible,
so filesystem::path is too.

That also means that path::_S_convert(T) is noexcept when returning its
argument, because T is either a basci_string or basic_string_view, and
will be moved into the return value.

libstdc++-v3/ChangeLog:

	* include/bits/fs_path.h (path(path&&)): Make unconditionally
	noexcept.
	(path::_S_convert(T)): Add condtional noexcept.
This commit is contained in:
Jonathan Wakely 2021-10-14 13:58:02 +01:00
parent 04a9b8d2f3
commit 373acac1c8

View file

@ -316,10 +316,7 @@ namespace __detail
path(const path& __p) = default;
path(path&& __p)
#if _GLIBCXX_USE_CXX11_ABI || _GLIBCXX_FULLY_DYNAMIC_STRING == 0
noexcept
#endif
path(path&& __p) noexcept
: _M_pathname(std::move(__p._M_pathname)),
_M_cmpts(std::move(__p._M_cmpts))
{ __p.clear(); }
@ -624,6 +621,7 @@ namespace __detail
template<typename _Tp>
static auto
_S_convert(_Tp __str)
noexcept(is_same_v<typename _Tp::value_type, value_type>)
{
if constexpr (is_same_v<typename _Tp::value_type, value_type>)
return __str; // No conversion needed.