gulrak / filesystem

An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ghc::filesystem::path::operator/= () fails for std::string_views

Febbe opened this issue · comments

Describe the bug
The /= operator can't handle std::string_views

To Reproduce
ghc::filesystem::path{"XYZ"} /= "Appendix"sv doesn't work`

Expected behavior
I would expect that a compiler compiling with c++17 support won't fail.

Additional context
using macOS 10.13 "High Sierra" with XCode 10.1
using ghc version 1.3.2

In file included from src/filesystem.h:14:
external/Source/ghcFilesystem_git/include/ghc/filesystem.hpp:2185:34: error: no matching function for call to 'toUtf8'
    return this->operator/=(path(detail::toUtf8(source)));
                                 ^~~~~~~~~~~~~~
external/Source/ghcFilesystem_git/include/ghc/filesystem.hpp:2179:12: note: in instantiation of function template specialization 'ghc::filesystem::path::append<std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
    return append(source);
           ^
../src/util/PathUtil.cpp:158:15: note: in instantiation of function template specialization 'ghc::filesystem::path::operator/=<std::__1::basic_string_view<char, std::__1::char_traits<char> > >' requested here
    return (p /= CONFIG_FOLDER_NAME);
              ^
external/Source/ghcFilesystem_git/include/ghc/filesystem.hpp:1383:20: note: candidate template ignored: could not match 'basic_string' against 'basic_string_view'
inline std::string toUtf8(const std::basic_string<charT, traits, Alloc>& unicodeString)
                   ^
external/Source/ghcFilesystem_git/include/ghc/filesystem.hpp:1389:20: note: candidate template ignored: could not match 'basic_string' against 'basic_string_view'
inline std::string toUtf8(const std::basic_string<charT, traits, Alloc>& unicodeString)
                   ^
external/Source/ghcFilesystem_git/include/ghc/filesystem.hpp:1418:20: note: candidate template ignored: could not match 'basic_string' against 'basic_string_view'
inline std::string toUtf8(const std::basic_string<charT, traits, Alloc>& unicodeString)
                   ^
external/Source/ghcFilesystem_git/include/ghc/filesystem.hpp:1428:20: note: candidate template ignored: could not match 'const charT *' against 'std::__1::basic_string_view<char, std::__1::char_traits<char> >'
inline std::string toUtf8(const charT* unicodeString)
                   ^
1 error generated.

Indeed, I'll look into it. Thanks for reporting!

Sorry it took so long, but I had a lot of paid work to do before the Hollidays so I had to delay working on this. Will bundle v1.3.10 later today or tomorrow at latest.

This is now part of release v1.3.10