[Bug libstdc++/94063] filesystem::path concatenation doesn't work for Windows root-paths

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 9 13:21:21 GMT 2020


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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
The test case for Cygwin (which is expected to fail on other targets) is 

#include <filesystem>
#include <assert.h>

using std::filesystem::path;

int main()
{
  path p;

  p = "/";
  p += path("/x");
  assert( p.has_root_name() );
  assert( p.root_name() == p );

  p = "/";
  p += "/x";
  assert( p.has_root_name() );
  assert( p.root_name() == p );

  p = "/";
  p += path("/");
  assert( !p.has_root_name() );
  assert( p.has_root_directory() );

  p = "/";
  p += "/";
  assert( !p.has_root_name() );
  assert( p.has_root_directory() );
}


More information about the Gcc-bugs mailing list