diff --git a/libcxx/include/__type_traits/remove_cv.h b/libcxx/include/__type_traits/remove_cv.h index c4bf612794bd55..8e1c0433643235 100644 --- a/libcxx/include/__type_traits/remove_cv.h +++ b/libcxx/include/__type_traits/remove_cv.h @@ -19,22 +19,17 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__remove_cv) && !defined(_LIBCPP_COMPILER_GCC) template struct remove_cv { using type _LIBCPP_NODEBUG = __remove_cv(_Tp); }; +#if defined(_LIBCPP_COMPILER_GCC) template -using __remove_cv_t = __remove_cv(_Tp); +using __remove_cv_t = typename remove_cv<_Tp>::type; #else template -struct _LIBCPP_TEMPLATE_VIS remove_cv { - typedef __remove_volatile_t<__remove_const_t<_Tp> > type; -}; - -template -using __remove_cv_t = __remove_volatile_t<__remove_const_t<_Tp> >; +using __remove_cv_t = __remove_cv(_Tp); #endif // __has_builtin(__remove_cv) #if _LIBCPP_STD_VER >= 14 diff --git a/libcxx/include/__type_traits/remove_cvref.h b/libcxx/include/__type_traits/remove_cvref.h index e8e8745ab09609..55f894dbd1d815 100644 --- a/libcxx/include/__type_traits/remove_cvref.h +++ b/libcxx/include/__type_traits/remove_cvref.h @@ -20,21 +20,26 @@ _LIBCPP_BEGIN_NAMESPACE_STD -#if __has_builtin(__remove_cvref) && !defined(_LIBCPP_COMPILER_GCC) +#if defined(_LIBCPP_COMPILER_GCC) template -using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); +struct __remove_cvref_gcc { + using type = __remove_cvref(_Tp); +}; + +template +using __remove_cvref_t _LIBCPP_NODEBUG = typename __remove_cvref_gcc<_Tp>::type; #else template -using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cv_t<__libcpp_remove_reference_t<_Tp> >; +using __remove_cvref_t _LIBCPP_NODEBUG = __remove_cvref(_Tp); #endif // __has_builtin(__remove_cvref) template -struct __is_same_uncvref : _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> > {}; +using __is_same_uncvref = _IsSame<__remove_cvref_t<_Tp>, __remove_cvref_t<_Up> >; #if _LIBCPP_STD_VER >= 20 template struct remove_cvref { - using type _LIBCPP_NODEBUG = __remove_cvref_t<_Tp>; + using type _LIBCPP_NODEBUG = __remove_cvref(_Tp); }; template