RFC: requiring C++17
Hi, for a long time we have been able to use and require only C++11.
This is getting harder to justify - C++17 if constexpr would allow considerably shorter code that may also be faster to compile. I believe GCC 7 has support for the C++17 language features and is about 8 years old. For Clang, v6 from 2018 should do.
Is anyone still using older compilers, or aware of anything that would break if we lift the language requirement to C++17?
@seiko2plus FYI.
Along with if constexpr, other language features like fold expression also imply C++14, which brings template-variables. It's a critical move to simplify the interface, clean it up, and speed up compilation time.
Is anyone still using older compilers, or aware of anything that would break if we lift the language requirement to C++17?
One caveat to requiring C++17 is that there are Clang 5 through Clang 12 packages for some earlier Linux distros such Ubuntu 16.04 that use libstdc++ 5 or libstdc++ 6 that do not include full C++17 standard library support by default. Clang 5 through Clang 12 packages for Ubuntu 16.04 can be found at https://apt.llvm.org/xenial/.
Features like std::is_trivially_copyable_v<T>, std::is_trivially_destructible_v<T>, and std::is_trivial_v<T> should be avoided if compatibility with Clang 5 through Clang 12 packages in earlier Linux distros that use libstdc++ 5 or libstdc++ 6 by default is still needed.
On the other hand, there are some C++17 core language features that are okay to use if the requirement is changed to C++17, even when compiling with libstdc++ 5 or libstdc++6 or when HWY_NO_LIBCXX is defined, such as if constexpr, function template dispatch, fold expressions, hex floating point literals, and static_assert with no message.
Some of the Google Highway targets also require a C++ compiler that has C++17 support, including AVX3_DL, AVX3_SPR, AVX3_ZEN4, AVX10_2, NEON_BF16, LSX, LASX, PPC10, RVV, SVE, SVE2, WASM, and Z15.
Thanks @johnplatts ! Good point, I should have been more explicit: the intention is indeed going for C++17 language features, not the standard library, because the latter may require much more recent GCC versions such as 11. We anyway use our own type traits, so that reduces the temptation to use C++17's library.
I agree many targets require more modern compilers, but someone might still just be using SSE4 or NEON with older compilers, hence I'd like to hear if there are such usages.