-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
codecvt_utf8 removed in C++26 #1098
Comments
Seems like at least there are two defines: (Also worth noting that I didn't have to do that on GCC 14 with C++26) |
I've worked around it like so:
|
Based on the anticipated standard for C++26, it seems like the appropriate thing to do is set CLI11_HAS_CODECVT=0 if we are in C++26, as that function call is deprecated due to it not meeting current unicode standards, so might not work right anyway. |
hmmm I am not getting a clang19 c++26 test to fail like indicated. in #1100. I made some potential modifications in macros.hpp. Would it be possible to try those modifications (uncomment them) in your setup. Also can you provide more details on your setup to see if it can be replicated in a CI build job? |
@phlptp . cd CLI11
git checkout main && git pull
mkdir -p ../build-CLI11 && cd ../build-CLI11
export CC="/opt/homebrew/opt/llvm@19/bin/clang"
export CXX="/opt/homebrew/opt/llvm@19/bin/clang++"
export CPPFLAGS="-I/opt/homebrew/opt/llvm@19/include"
export LDFLAGS="-L/opt/homebrew/opt/llvm@19/lib/c++ -Wl,-rpath,/opt/homebrew/opt/llvm@19/lib/c++"
cmake -G Ninja -DCMAKE_CXX_STANDARD=26 -DCMAKE_CXX_EXTENSIONS:BOOL=OFF -DCMAKE_CXX_STANDARD_REQUIRED:BOOL=ON -DCMAKE_CXX_FLAGS_INIT:STRING="-stdlib=libc++" ../CLI11
ninja [ 50%][116/228] Building CXX object tests/CMakeFiles/ensure_utf8.dir/applications/ensure_utf8.cpp.o
FAILED: tests/CMakeFiles/ensure_utf8.dir/applications/ensure_utf8.cpp.o
/opt/homebrew/opt/llvm@19/bin/clang++ -I/Users/julien/Software/Others/CLI11/include -stdlib=libc++ -std=c++26 -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=12.1 -MD -MT tests/CMakeFiles/ensure_utf8.dir/applications/ensure_utf8.cpp.o -MF tests/CMakeFiles/ensure_utf8.dir/applications/ensure_utf8.cpp.o.d @tests/CMakeFiles/ensure_utf8.dir/applications/ensure_utf8.cpp.o.modmap -o tests/CMakeFiles/ensure_utf8.dir/applications/ensure_utf8.cpp.o -c /Users/julien/Software/Others/CLI11/tests/applications/ensure_utf8.cpp
In file included from /Users/julien/Software/Others/CLI11/tests/applications/ensure_utf8.cpp:7:
In file included from /Users/julien/Software/Others/CLI11/include/CLI/CLI.hpp:18:
In file included from /Users/julien/Software/Others/CLI11/include/CLI/Encoding.hpp:54:
/Users/julien/Software/Others/CLI11/include/CLI/impl/Encoding_inl.hpp:68:17: error: no member named 'wstring_convert' in namespace 'std'
68 | return std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(str, str + str_size);
| ~~~~~^
/Users/julien/Software/Others/CLI11/include/CLI/impl/Encoding_inl.hpp:68:38: error: no member named 'codecvt_utf8' in namespace 'std'
68 | return std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(str, str + str_size);
| ~~~~~^
/Users/julien/Software/Others/CLI11/include/CLI/impl/Encoding_inl.hpp:68:58: error: expected '(' for function-style cast or type construction
68 | return std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(str, str + str_size);
| ~~~~~~~^
/Users/julien/Software/Others/CLI11/include/CLI/impl/Encoding_inl.hpp:68:61: error: expected expression
68 | return std::wstring_convert<std::codecvt_utf8<wchar_t>>().to_bytes(str, str + str_size);
| ^
/Users/julien/Software/Others/CLI11/include/CLI/impl/Encoding_inl.hpp:99:17: error: no member named 'wstring_convert' in namespace 'std'
99 | return std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(str, str + str_size);
| ~~~~~^
/Users/julien/Software/Others/CLI11/include/CLI/impl/Encoding_inl.hpp:99:38: error: no member named 'codecvt_utf8' in namespace 'std'
99 | return std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(str, str + str_size);
| ~~~~~^
/Users/julien/Software/Others/CLI11/include/CLI/impl/Encoding_inl.hpp:99:58: error: expected '(' for function-style cast or type construction
99 | return std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(str, str + str_size);
| ~~~~~~~^
/Users/julien/Software/Others/CLI11/include/CLI/impl/Encoding_inl.hpp:99:61: error: expected expression
99 | return std::wstring_convert<std::codecvt_utf8<wchar_t>>().from_bytes(str, str + str_size);
| ^
8 errors generated. System info: This is an M1 Max.
|
I checked out 464306b from #1100 (before you commented the macros out). I get a different build error
|
I will keep trying, thanks |
CLI11/include/CLI/Macros.hpp
Lines 98 to 104 in 063b2c9
Using llvm 19, in C++26 mode, can't compile
The text was updated successfully, but these errors were encountered: