From 4e1d3fb734903095a7c4ce50744288b3aaa0e0b7 Mon Sep 17 00:00:00 2001 From: marehr Date: Wed, 16 Sep 2020 11:35:09 +0200 Subject: [PATCH] [FIX] workaround gcc versions that forgot to define __cpp_lib_remove_cvref --- include/seqan3/std/type_traits | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/include/seqan3/std/type_traits b/include/seqan3/std/type_traits index 717aeccbe88..cc626ad3458 100644 --- a/include/seqan3/std/type_traits +++ b/include/seqan3/std/type_traits @@ -15,13 +15,25 @@ #include +//!\brief A workaround for __cpp_lib_remove_cvref for gcc version >=9.0 and <9.4 (in C++17 mode). +//! Those versions implemented std::remove_cvref_t, but did not define that feature detection macro. +#ifndef SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF +# if defined(__cpp_lib_remove_cvref) +# define SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF 1 +# elif defined(__GNUC__) && ((__GNUC__ == 9) && (__GNUC_MINOR__ < 4)) && __cplusplus > 201703L +# define SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF 1 +# else +# define SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF 0 +# endif +#endif + namespace std { // ---------------------------------------------------------------------------- // remove_cvref_t // ---------------------------------------------------------------------------- -#ifndef __cpp_lib_remove_cvref +#if !SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF /*!\brief Return the input type with `const`, `volatile` and references removed. * \tparam t The type to operate on. */ @@ -42,7 +54,7 @@ struct remove_cvref // needed for gcc-9, it defines std::remove_cvref but doe */ template using remove_cvref_t = typename remove_cvref::type; -#endif // __cpp_lib_remove_cvref +#endif // !SEQAN3_WORKAROUND_CPP_LIB_REMOVE_CVREF // ---------------------------------------------------------------------------- // type_identity