This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/84159] New: filesystem::path::operator/= with has root directory path


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

            Bug ID: 84159
           Summary: filesystem::path::operator/= with has root directory
                    path
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: faithandbrave at gmail dot com
  Target Milestone: ---

Standard says: 

N4660 30.10.8.4.3 path appends [fs.path.append]

// On POSIX,
path("foo") / ""; // yields "foo/"
path("foo") / "/bar"; // yields "/bar"

However, 2nd line yields "foo/bar".

#include <iostream>
#include <filesystem>

namespace fs = std::filesystem;

int main()
{
  fs::path p = "foo";
  p /= "/bar";
  std::cout << << p << std::endl;
}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]