Skip to content

path is not implicitly constructible from UTF-8, UTF-16 or UTF-32 literals #119

Closed
@zero9178

Description

@zero9178

Implementations of std::filesystem I have tested (libc++, libstdc++ and MSVC STL) all support the use of u8, u16 and u32 string literals to construct a path using constructor 5 described here in cppreference: https://en.cppreference.com/w/cpp/filesystem/path/path

The relevant standard text is https://eel.is/c++draft/fs.path.type.cvt I believe, though I am not well versed in the C++ Standard.

I encountered this issue with the following code:

#include <filesystem>

int main()
{
    ghc::filesystem::exists(u8"test");
}

which failed to compile in C++20 mode when I was using either Clang 12 or GCC 11 (on Windows). I believe it should also be reproducible using UTF-16 or UTF-32 literals in C++17 mode.

The same code in CE, showing all 3 STL implementations compiling the above:
https://godbolt.org/z/Gd835xxGv

Metadata

Metadata

Assignees

Labels

available on masterFix is done on master branch, issue closed on next releasebugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions