Open AStepaniuk opened 1 year ago
When I'm trying to enable С++ 20 standard (using gcc 9.5 on ubuntu) I'm getting build error similar to the one mentioned at #498 .
I think, it is caused by the change in C++20 filesystem lib: https://en.cppreference.com/w/cpp/filesystem/path/string
std::string u8string() const; | (since C++17)(until C++20) std::u8string u8string() const; | (since C++20)
std::string u8string() const;
std::u8string u8string() const;
In turn, std::u8string is declared as: std::basic_string<char8_t> , which is incompatible with std::string.
std::u8string
std::basic_string<char8_t>
std::string
A short-term fix: Switching to C++17 eliminates the build error.
As a long-term fix, maybe it worth to use std::filesystem::path::string() method instead of ...u8string()? In the current master branch there is at least one place, where u8string() is used: https://github.com/cnjinhao/nana/blob/master/source/detail/posix/xdnd_protocol.hpp#L159
std::filesystem::path::string()
...u8string()
u8string()
According to https://en.cppreference.com/w/cpp/filesystem/path/string using string() should be safe for POSIX:
string()
If path::value_type is char, conversion, if any, is system-dependent. This is the case on typical POSIX systems (such as Linux), where native encoding is UTF-8 and string() performs no conversion.
path::value_type
char
When I'm trying to enable С++ 20 standard (using gcc 9.5 on ubuntu) I'm getting build error similar to the one mentioned at #498 .
I think, it is caused by the change in C++20 filesystem lib: https://en.cppreference.com/w/cpp/filesystem/path/string
In turn,
std::u8string
is declared as:std::basic_string<char8_t>
, which is incompatible withstd::string
.A short-term fix: Switching to C++17 eliminates the build error.
As a long-term fix, maybe it worth to use
std::filesystem::path::string()
method instead of...u8string()
?In the current master branch there is at least one place, where
u8string()
is used: https://github.com/cnjinhao/nana/blob/master/source/detail/posix/xdnd_protocol.hpp#L159According to https://en.cppreference.com/w/cpp/filesystem/path/string using
string()
should be safe for POSIX: