We seeing a couple build failures with GCC 11: #1 /home/abuild/rpmbuild/BUILD/kseexpr-4.0.1.0/src/KSeExpr/Utils.cpp:13:52: error: 'strlen' is not a member of 'std'; did you mean 'mbrlen'? This file needs a cstring include #2 [ 43s] /home/abuild/rpmbuild/BUILD/kseexpr-4.0.1.0/src/KSeExpr/Utils.cpp: In function 'double_t KSeExpr::Utils::atof(const char*)': [ 43s] /home/abuild/rpmbuild/BUILD/kseexpr-4.0.1.0/src/KSeExpr/Utils.cpp:14:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [ 43s] 14 | auto [p, ec] = std::from_chars(num, num + std::strlen(num), v); [ 43s] | ^ [ 43s] /home/abuild/rpmbuild/BUILD/kseexpr-4.0.1.0/src/KSeExpr/Utils.cpp: In function 'double_t KSeExpr::Utils::atof(const string&)': [ 43s] /home/abuild/rpmbuild/BUILD/kseexpr-4.0.1.0/src/KSeExpr/Utils.cpp:25:10: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17' [ 43s] 25 | auto [p, ec] = std::from_chars(val.data(), val.data() + val.size(), v); [ 43s] | ^ [ 43s] /home/abuild/rpmbuild/BUILD/kseexpr-4.0.1.0/src/KSeExpr/Utils.cpp:25:36: error: 'val' was not declared in this scope [ 43s] 25 | auto [p, ec] = std::from_chars(val.data(), val.data() + val.size(), v); [ 43s] | ^~~
FTR, KSeExpr_HAVE_CHARCONV_WITH_DOUBLES is defined with GCC 11 but not with GCC 10 or clang. This code may have always been broken
Confirming, I'll try and get my hands on GCC11. You're indeed correct, because this codepath was designed for the case where we could use C++17 (we're stuck in 14 in Krita).
The strlen part is clearly a bug on my end. The remaining are a "feature" of both GCC and glibc. If my tests are correct, <charconv> should *not* be available if the C++ standard is less than 17 (as in our case), see https://en.cppreference.com/w/cpp/header/charconv . This should also fail as soon as it tries to build the structured bindings.
> if the C++ standard is less than 17 (as in our case) That's not the case afaics. If you want to enforce CXX 14, you need `set(CMAKE_CXX_STANDARD_REQUIRED ON)` after `set(CMAKE_CXX_STANDARD 14)` in the main CMakeLists.txt
Note that it won't affect the charconv test in src/KSeExpr/CMakeLists.txt. If you don't want it, just comment out lines 60 to 71
Git commit 1e8e6c8da1e22c4d32e50d8999705fd370824736 by L. E. Segovia. Committed on 01/06/2021 at 23:35. Pushed by lsegovia into branch 'master'. Fix charconv support with MSVC/GCC11 M +3 -2 src/KSeExpr/Utils.cpp https://invent.kde.org/graphics/kseexpr/commit/1e8e6c8da1e22c4d32e50d8999705fd370824736