This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [PATCH] LWG 3171: restore stream insertion for filesystem::directory_entry
- From: Jonathan Wakely <jwakely at redhat dot com>
- To: Tim Song <t dot canens dot cpp at gmail dot com>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 20 Dec 2018 12:32:19 +0000
- Subject: Re: [PATCH] LWG 3171: restore stream insertion for filesystem::directory_entry
- References: <20181218165741.GA12440@redhat.com> <CAPQZVxt3Qm-s0rM2QzZPrXggdRDW-xZqEuS7rK5RqKDMgfO=EQ@mail.gmail.com>
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.
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();
+}