* [PATCH] LWG 3171: restore stream insertion for filesystem::directory_entry
@ 2018-12-18 16:57 Jonathan Wakely
2018-12-20 9:09 ` Tim Song
0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Wakely @ 2018-12-18 16:57 UTC (permalink / raw)
To: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 199 bytes --]
* include/bits/fs_dir.h (operator<<): Overload for directory_entry,
as per LWG 3171.
* testsuite/27_io/filesystem/directory_entry/lwg3171.cc: New test.
Tested x86_64-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 1174 bytes --]
commit 0d24038c0b565dbcd5e7729423398da281245c41
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Tue Dec 18 16:47:52 2018 +0000
LWG 3171: restore stream insertion for filesystem::directory_entry
* include/bits/fs_dir.h (operator<<): Overload for directory_entry,
as per LWG 3171.
* testsuite/27_io/filesystem/directory_entry/lwg3171.cc: New test.
diff --git a/libstdc++-v3/include/bits/fs_dir.h b/libstdc++-v3/include/bits/fs_dir.h
index 2f81a1709e4..90bdf7305f8 100644
--- a/libstdc++-v3/include/bits/fs_dir.h
+++ b/libstdc++-v3/include/bits/fs_dir.h
@@ -300,6 +300,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
friend class directory_iterator;
friend class recursive_directory_iterator;
+ // _GLIBCXX_RESOLVE_LIB_DEFECTS
+ // 3171. LWG 2989 breaks directory_entry stream insertion
+ template<typename _CharT, typename _Traits>
+ friend basic_ostream<_CharT, _Traits>&
+ operator<<(basic_ostream<_CharT, _Traits>& __os,
+ const directory_entry& __d)
+ { return __os << __d.path(); }
+
directory_entry(const filesystem::path& __p, file_type __t)
: _M_path(__p), _M_type(__t)
{ }
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] LWG 3171: restore stream insertion for filesystem::directory_entry
2018-12-18 16:57 [PATCH] LWG 3171: restore stream insertion for filesystem::directory_entry Jonathan Wakely
@ 2018-12-20 9:09 ` Tim Song
2018-12-20 13:05 ` Jonathan Wakely
0 siblings, 1 reply; 3+ messages in thread
From: Tim Song @ 2018-12-20 9:09 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: libstdc++, gcc-patches
On Tue, Dec 18, 2018 at 10:57 AM Jonathan Wakely <jwakely@redhat.com> wrote:
> * include/bits/fs_dir.h (operator<<): Overload for directory_entry,
> as per LWG 3171.
> * testsuite/27_io/filesystem/directory_entry/lwg3171.cc: New test.
>
> Tested x86_64-linux, committed to trunk.
>
>
>
The test seems to be missing from the patch.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] LWG 3171: restore stream insertion for filesystem::directory_entry
2018-12-20 9:09 ` Tim Song
@ 2018-12-20 13:05 ` Jonathan Wakely
0 siblings, 0 replies; 3+ messages in thread
From: Jonathan Wakely @ 2018-12-20 13:05 UTC (permalink / raw)
To: Tim Song; +Cc: libstdc++, gcc-patches
[-- Attachment #1: Type: text/plain, Size: 480 bytes --]
On 20/12/18 04:08 -0500, Tim Song wrote:
>On Tue, Dec 18, 2018 at 10:57 AM Jonathan Wakely <jwakely@redhat.com> wrote:
>
>> * include/bits/fs_dir.h (operator<<): Overload for directory_entry,
>> as per LWG 3171.
>> * testsuite/27_io/filesystem/directory_entry/lwg3171.cc: New test.
>>
>> Tested x86_64-linux, committed to trunk.
>>
>>
>>
>The test seems to be missing from the patch.
Thanks, I forgot to 'git add' it. Fixed by this, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 1790 bytes --]
commit 7274fd7de0a1ea4c8ab12cec8a6a5ae38bcbdea1
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Dec 20 12:13:17 2018 +0000
Add missing test from previous commit
* testsuite/27_io/filesystem/directory_entry/lwg3171.cc: New test
(missed from previous commit).
diff --git a/libstdc++-v3/testsuite/27_io/filesystem/directory_entry/lwg3171.cc b/libstdc++-v3/testsuite/27_io/filesystem/directory_entry/lwg3171.cc
new file mode 100644
index 00000000000..d9adffbac4d
--- /dev/null
+++ b/libstdc++-v3/testsuite/27_io/filesystem/directory_entry/lwg3171.cc
@@ -0,0 +1,40 @@
+// Copyright (C) 2018 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING3. If not see
+// <http://www.gnu.org/licenses/>.
+
+// { dg-options "-std=gnu++17 -lstdc++fs" }
+// { dg-do run { target c++17 } }
+// { dg-require-filesystem-ts "" }
+
+#include <filesystem>
+#include <sstream>
+#include <testsuite_hooks.h>
+
+void
+test01()
+{
+ std::filesystem::directory_entry ent("foo/bar");
+ std::ostringstream os1, os2;
+ os1 << ent;
+ os2 << ent.path();
+ VERIFY( os1.str() == os2.str() );
+}
+
+int
+main()
+{
+ test01();
+}
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-20 12:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-18 16:57 [PATCH] LWG 3171: restore stream insertion for filesystem::directory_entry Jonathan Wakely
2018-12-20 9:09 ` Tim Song
2018-12-20 13:05 ` Jonathan Wakely
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).