From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id 881073858419; Thu, 14 Oct 2021 21:19:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 881073858419 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r12-4418] libstdc++: Make filesystem::path(path&&) always noexcept X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/master X-Git-Oldrev: 04a9b8d2f38573d0527edeea9e4fd9b7dfdc7983 X-Git-Newrev: 373acac1c8f2d64409ccea6aea409a0e15e80a6a Message-Id: <20211014211946.881073858419@sourceware.org> Date: Thu, 14 Oct 2021 21:19:46 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Oct 2021 21:19:46 -0000 https://gcc.gnu.org/g:373acac1c8f2d64409ccea6aea409a0e15e80a6a commit r12-4418-g373acac1c8f2d64409ccea6aea409a0e15e80a6a Author: Jonathan Wakely Date: Thu Oct 14 13:58:02 2021 +0100 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. Diff: --- libstdc++-v3/include/bits/fs_path.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index a63e4b9ab07..d13fb12455c 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -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 static auto _S_convert(_Tp __str) + noexcept(is_same_v) { if constexpr (is_same_v) return __str; // No conversion needed.