https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89117
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Fri Feb 8 12:20:03 2019 New Revision: 268681 URL: https://gcc.gnu.org/viewcvs?rev=268681&root=gcc&view=rev Log: PR libstdc++/89117 backport path::replace_extension("") fix Although the reported bug isn't present on the branch, adjusting the final component avoids leaving a broken invariant in case of an exception. Backport from mainline 2019-01-30 Jonathan Wakely <jwak...@redhat.com> PR libstdc++/89117 * src/c++17/fs_path.cc (path::replace_extension): Erase extension from final component as well as from _M_pathname. * testsuite/27_io/filesystem/path/modifiers/replace_extension.cc: Add more test cases. 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/modifiers/replace_extension.cc