diff --git a/include/continuable/detail/features.hpp b/include/continuable/detail/features.hpp index e59408e..dc33b3a 100644 --- a/include/continuable/detail/features.hpp +++ b/include/continuable/detail/features.hpp @@ -55,6 +55,7 @@ #define CONTINUABLE_HAS_CXX17_CONSTEXPR_IF #define CONTINUABLE_HAS_CXX17_DISJUNCTION #define CONTINUABLE_HAS_CXX17_CONJUNCTION + #define CONTINUABLE_HAS_CXX17_VOID_T #else // Generic feature detection based on __has_feature #if defined(__has_feature) @@ -75,6 +76,12 @@ (__cpp_lib_experimental_logical_traits >= 201511) #define CONTINUABLE_HAS_CXX17_CONJUNCTION #endif + + #if !defined(CONTINUABLE_HAS_CXX17_VOID_T) && \ + defined(__cpp_lib_void_t) && \ + (__cpp_lib_void_t >= 201411) + #define CONTINUABLE_HAS_CXX17_VOID_T + #endif #endif /// Usually this is enabled by the CMake project @@ -85,7 +92,7 @@ /// Define CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE when /// CONTINUABLE_WITH_EXPERIMENTAL_COROUTINE is defined. -#if !defined(CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE) && \ +#if !defined(CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE) && \ defined(CONTINUABLE_WITH_EXPERIMENTAL_COROUTINE) #define CONTINUABLE_HAS_EXPERIMENTAL_COROUTINE #endif diff --git a/include/continuable/detail/traits.hpp b/include/continuable/detail/traits.hpp index cba0245..7d1363d 100644 --- a/include/continuable/detail/traits.hpp +++ b/include/continuable/detail/traits.hpp @@ -90,6 +90,9 @@ constexpr auto get(identity) noexcept { return identify>{}; } +#if defined(CONTINUABLE_HAS_CXX17_VOID_T) +using std::void_t; +#else namespace detail { // Equivalent to C++17's std::void_t which targets a bug in GCC, // that prevents correct SFINAE behavior. @@ -101,6 +104,7 @@ struct deduce_to_void : std::common_type {}; /// C++17 like void_t type template using void_t = typename detail::deduce_to_void::type; +#endif // CONTINUABLE_HAS_CXX17_VOID_T namespace detail { template