public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed] libstdc++: Make filesystem::path(path&&) always noexcept
Date: Thu, 14 Oct 2021 22:19:51 +0100	[thread overview]
Message-ID: <YWie997sKp2yWft7@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

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.

Tested powerpc64le-linux. Committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1534 bytes --]

commit 373acac1c8f2d64409ccea6aea409a0e15e80a6a
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Oct 14 13:58:02 2021

    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 --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<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.

                 reply	other threads:[~2021-10-14 21:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YWie997sKp2yWft7@redhat.com \
    --to=jwakely@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).