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++: Move Filesystem TS path definitions out of class body
Date: Mon, 11 Apr 2022 15:54:08 +0100	[thread overview]
Message-ID: <20220411145408.76186-1-jwakely@redhat.com> (raw)

Tested x86_64-linux, pushed to trunk.

-- >8 --

This fixes some errors with clang caused by instantiating vector<_Cmpt>
before the _Cmpt type is complete.

libstdc++-v3/ChangeLog:

	* include/experimental/bits/fs_path.h (path): Define special
	members after path::_Cmpt is complete.
---
 .../include/experimental/bits/fs_path.h       | 59 ++++++++++++-------
 1 file changed, 38 insertions(+), 21 deletions(-)

diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h
index 803df424664..b0825ba76e8 100644
--- a/libstdc++-v3/include/experimental/bits/fs_path.h
+++ b/libstdc++-v3/include/experimental/bits/fs_path.h
@@ -212,21 +212,11 @@ namespace __detail
 
     // constructors and destructor
 
-    path() noexcept { }
+    path() noexcept;
+    path(const path& __p);
+    path(path&& __p) noexcept;
 
-    path(const path& __p) = default;
-
-    path(path&& __p) noexcept
-    : _M_pathname(std::move(__p._M_pathname)), _M_type(__p._M_type)
-    {
-      if (_M_type == _Type::_Multi)
-	_M_split_cmpts();
-      __p.clear();
-    }
-
-    path(string_type&& __source)
-    : _M_pathname(std::move(__source))
-    { _M_split_cmpts(); }
+    path(string_type&& __source);
 
     template<typename _Source,
 	     typename _Require = __detail::_Path<_Source>>
@@ -256,11 +246,11 @@ namespace __detail
       : _M_pathname(_S_convert_loc(__first, __last, __loc))
       { _M_split_cmpts(); }
 
-    ~path() = default;
+    ~path();
 
     // assignments
 
-    path& operator=(const path& __p) = default;
+    path& operator=(const path& __p);
     path& operator=(path&& __p) noexcept;
     path& operator=(string_type&& __source);
     path& assign(string_type&& __source);
@@ -449,11 +439,7 @@ namespace __detail
 	_Multi, _Root_name, _Root_dir, _Filename
     };
 
-    path(string_type __str, _Type __type) : _M_pathname(__str), _M_type(__type)
-    {
-      __glibcxx_assert(!empty());
-      __glibcxx_assert(_M_type != _Type::_Multi);
-    }
+    path(string_type __str, _Type __type);
 
     enum class _Split { _Stem, _Extension };
 
@@ -908,6 +894,37 @@ namespace __detail
     bool			_M_at_end;  // only used when type != _Multi
   };
 
+  inline
+  path::path() noexcept = default;
+
+  inline
+  path::path(const path&) = default;
+
+  inline
+  path::path(path&& __p) noexcept
+  : _M_pathname(std::move(__p._M_pathname)),
+    _M_cmpts(__p._M_cmpts),
+    _M_type(__p._M_type)
+  { __p.clear(); }
+
+  inline
+  path::path(string_type&& __source)
+  : _M_pathname(std::move(__source))
+  { _M_split_cmpts(); }
+
+  inline
+  path::path(string_type __str, _Type __type)
+  : _M_pathname(__str), _M_type(__type)
+  {
+    __glibcxx_assert(!empty());
+    __glibcxx_assert(_M_type != _Type::_Multi);
+  }
+
+  inline
+  path::~path() = default;
+
+  inline path&
+  path::operator=(const path& __p) = default;
 
   inline path&
   path::operator=(path&& __p) noexcept
-- 
2.34.1


                 reply	other threads:[~2022-04-11 14:54 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=20220411145408.76186-1-jwakely@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).