mirror of
https://github.com/CLIUtils/CLI11.git
synced 2026-01-19 04:52:08 +00:00
update macros for codecvt and support C++26 support on clang19 (#1113)
* Modifies #1100
* That PR comes from https://github.com/phlptp/CLI11 and unfortunately I
have no way of opening a PR to that repo, pointing to that branch...
The commit you care about is
9a2884ad6a
@phlptp
where I fix the build error on LLVM 19 with C++26 after rooting the
actual template issue (see
https://github.com/CLIUtils/CLI11/issues/1098#issuecomment-2572715578)
It comes down to C++26 adding a tuple interface to std::complex
https://en.cppreference.com/w/cpp/numeric/complex/tuple_size
---------
Co-authored-by: Philip Top <phlptp@gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
@@ -18,11 +18,17 @@
|
||||
#define CLI11_CPP17
|
||||
#if __cplusplus > 201703L
|
||||
#define CLI11_CPP20
|
||||
#if __cplusplus > 202002L
|
||||
#define CLI11_CPP23
|
||||
#if __cplusplus > 202302L
|
||||
#define CLI11_CPP26
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#elif defined(_MSC_VER) && __cplusplus == 199711L
|
||||
// MSVC sets _MSVC_LANG rather than __cplusplus (supposedly until the standard is fully implemented)
|
||||
// MSVC sets _MSVC_LANG rather than __cplusplus (supposedly until the standard was fully implemented)
|
||||
// Unless you use the /Zc:__cplusplus flag on Visual Studio 2017 15.7 Preview 3 or newer
|
||||
#if _MSVC_LANG >= 201402L
|
||||
#define CLI11_CPP14
|
||||
@@ -30,6 +36,9 @@
|
||||
#define CLI11_CPP17
|
||||
#if _MSVC_LANG > 201703L && _MSC_VER >= 1910
|
||||
#define CLI11_CPP20
|
||||
#if _MSVC_LANG > 202002L && _MSC_VER >= 1922
|
||||
#define CLI11_CPP23
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
@@ -96,12 +105,22 @@
|
||||
#endif
|
||||
|
||||
/** <codecvt> availability */
|
||||
#if !defined(CLI11_CPP26) && !defined(CLI11_HAS_CODECVT)
|
||||
#if defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && __GNUC__ < 5
|
||||
#define CLI11_HAS_CODECVT 0
|
||||
#else
|
||||
#define CLI11_HAS_CODECVT 1
|
||||
#include <codecvt>
|
||||
#endif
|
||||
#else
|
||||
#if defined(CLI11_HAS_CODECVT)
|
||||
#if CLI11_HAS_CODECVT > 0
|
||||
#include <codecvt>
|
||||
#endif
|
||||
#else
|
||||
#define CLI11_HAS_CODECVT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** disable deprecations */
|
||||
#if defined(__GNUC__) // GCC or clang
|
||||
|
||||
@@ -295,8 +295,9 @@ template <typename T>
|
||||
struct is_wrapper<T, conditional_t<false, void_t<typename T::value_type>, void>> : public std::true_type {};
|
||||
|
||||
// Check for tuple like types, as in classes with a tuple_size type trait
|
||||
// Even though in C++26 std::complex gains a std::tuple interface, for our purposes we treat is as NOT a tuple
|
||||
template <typename S> class is_tuple_like {
|
||||
template <typename SS>
|
||||
template <typename SS, enable_if_t<!is_complex<SS>::value, detail::enabler> = detail::dummy>
|
||||
// static auto test(int)
|
||||
// -> decltype(std::conditional<(std::tuple_size<SS>::value > 0), std::true_type, std::false_type>::type());
|
||||
static auto test(int) -> decltype(std::tuple_size<typename std::decay<SS>::type>::value, std::true_type{});
|
||||
|
||||
Reference in New Issue
Block a user