r267816 - in /branches/gcc-8-branch/libstdc++-v...

redi@gcc.gnu.org redi@gcc.gnu.org
Thu Jan 10 16:37:00 GMT 2019


Author: redi
Date: Thu Jan 10 16:37:44 2019
New Revision: 267816

URL: https://gcc.gnu.org/viewcvs?rev=267816&root=gcc&view=rev
Log:
Fix bugs in filesystem::path::lexically_normal()

Using path::_List::erase(const_iterator) to remove a non-final component
in path::lexically_normal() is a bug, because it leaves the following
component with an incorrect _M_pos value.

The buggy erase call is replaced by calls to pop_back() and/or clearing
the last component to leave it as an empty final filename.

Also replace the "???" comment in lexically_normal() to document when
that branch is taken.

Backport from mainline
2019-01-04  Jonathan Wakely  <jwakely@redhat.com>

	(path::lexically_normal()): Use std::vector iterators instead of
	path::iterator. Use pop_back to remove components from the end. Clear
	trailing filename, instead of using erase(const_iterator) to remove
	a non-final component.
	* testsuite/27_io/filesystem/path/generation/normal.cc: Test
	additional cases.
	* testsuite/27_io/filesystem/path/generation/normal2.cc: New test.

Added:
    branches/gcc-8-branch/libstdc++-v3/testsuite/27_io/filesystem/path/generation/normal2.cc
Modified:
    branches/gcc-8-branch/libstdc++-v3/ChangeLog
    branches/gcc-8-branch/libstdc++-v3/src/filesystem/std-path.cc
    branches/gcc-8-branch/libstdc++-v3/testsuite/27_io/filesystem/path/generation/normal.cc



More information about the Libstdc++-cvs mailing list