https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106127

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This patch:

--- a/libstdc++-v3/src/filesystem/path.cc
+++ b/libstdc++-v3/src/filesystem/path.cc
@@ -377,7 +377,7 @@ path::_M_split_cmpts()
          if (len == 2)
            {
              // entire path is just "//"
-             _M_type = _Type::_Root_name;
+             _M_type = _Type::_Root_dir;
              return;
            }

fixes the absolute.cc test on Windows and causes only one new FAIL (on all
targets):

/home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/experimental/filesystem/path/decompose/root_directory.cc:52:
void test02(): Assertion 'rootdir.string()[0] != '/'' failed.
FAIL: experimental/filesystem/path/decompose/root_directory.cc execution test

The test seems questionable anyway:

void
test02()
{
  for (const path p : __gnu_test::test_paths)
  {
    path rootdir = p.root_directory();
    // If root-directory is composed of 'slash name',
    // 'slash' is excluded from the returned string.
    if (!rootdir.empty() && rootdir.string() != "/")
      VERIFY( rootdir.string()[0] != '/' );
  }
}

This fails with the change because "//" behaves the same as "/" and so still
has a leading slash.

Reply via email to