libstdc++: Fix path::generic_string allocator handling (PR 94242)
authorJonathan Wakely <jwakely@redhat.com>
Sat, 21 Mar 2020 21:51:07 +0000 (21:51 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Sat, 21 Mar 2020 22:04:48 +0000 (22:04 +0000)
commit9fc985118d9f5014afc1caf32a411ee5803fba61
tree1e6aaade4c304f7f5c240715682adc07cd1d70b3
parentdfb25dfe3d34703f6e493664831dfaf53672b07b
libstdc++: Fix path::generic_string allocator handling (PR 94242)

It's not possible to construct a path::string_type from an allocator of
a different type. Create the correct specialization of basic_string, and
adjust path::_S_str_convert to use a basic_string_view so that it is
independent of the allocator type.

PR libstdc++/94242
* include/bits/fs_path.h (path::_S_str_convert): Replace first
parameter with basic_string_view so that strings with different
allocators can be accepted.
(path::generic_string<C,T,A>()): Use basic_string object that uses the
right allocator type.
* testsuite/27_io/filesystem/path/generic/94242.cc: New test.
* testsuite/27_io/filesystem/path/generic/generic_string.cc: Improve
test coverage.
libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/fs_path.h
libstdc++-v3/testsuite/27_io/filesystem/path/generic/94242.cc [new file with mode: 0644]
libstdc++-v3/testsuite/27_io/filesystem/path/generic/generic_string.cc