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

Building with clang c++17, wide chars

greenkalx opened this issue · comments

Describe the bug
Building in Visual Studio with the wide character flag: GHC_WIN_WSTRING_STRING_TYPE
With clang 11, and c++17, I have these warnings/errors:

1>In file included from D:\filesystem\test\filesystem_test.cpp:62: 1>D:\filesystem\include\ghc/filesystem.hpp(4509,50): error : suggest braces around initialization of subobject [-Werror,-Wmissing-braces] 1>D:\filesystem\include\ghc/filesystem.hpp(4510,42): error : suggest braces around initialization of subobject [-Werror,-Wmissing-braces] 1>D:\filesystem\include\ghc/filesystem.hpp(4511,46): error : suggest braces around initialization of subobject [-Werror,-Wmissing-braces] 1>D:\filesystem\include\ghc/filesystem.hpp(1649,13): error : no matching function for call to 'toUtf8' 1>D:\filesystem\include\ghc/filesystem.hpp(2628,29): message : in instantiation of function template specialization 'ghc::filesystem::path::path<std::basic_string_view<wchar_t, std::char_traits<wchar_t> >, ghc::filesystem::path>' requested here 1>D:\filesystem\include\ghc/filesystem.hpp(1536,20): message : candidate template ignored: could not match 'basic_string' against 'basic_string_view' 1>D:\filesystem\include\ghc/filesystem.hpp(1542,20): message : candidate template ignored: could not match 'basic_string' against 'basic_string_view' 1>D:\filesystem\include\ghc/filesystem.hpp(1571,20): message : candidate template ignored: could not match 'basic_string' against 'basic_string_view' 1>D:\filesystem\include\ghc/filesystem.hpp(1581,20): message : candidate template ignored: could not match 'const charT *' against 'std::basic_string_view<wchar_t, std::char_traits<wchar_t> >'

Please find my Visual Studio project file for filesystem_test attached. (just trim the .txt extension)

Note! clang compiles with only the first three warnings with c++11 (without the actual basic_string_view error)

To create the Visual Studio solution and projects, I ran:
cmake -G "Visual Studio 15 2017 Win64"

I am working with latest on master: commit 9a047b9

To Reproduce
Compile as above

Expected behavior
Compiles, no errors. Warnings are negotiable. :)

Additional context

Thank you for creating this library. I was working with the Windows filesystem, which I found did not support path appending as expected. And I want to have standard cross-platform support.

filesystem_test.vcxproj.txt

Small update.
I'm going to try sticking with c++11 instead of c++17 which I was mostly using just for std::filesystem.
But I found in my app, that I get the same error above with c++11.
Not with filesystem_test and c++11.

Testing solutions on branch feature-63-windows-clang-issues.

Can you try the branch version? I don't have your configuration for testing, I tried with a combination of VS2019 and llvm 9, got those errors as well and fixed them there, so I guess it should work, but I just want to make sure it works for you.

Thank you, that's compiling!

Good to hear, thanks for testing!