diff --git a/libcxx/include/__type_traits/common_type.h b/libcxx/include/__type_traits/common_type.h --- a/libcxx/include/__type_traits/common_type.h +++ b/libcxx/include/__type_traits/common_type.h @@ -57,25 +57,10 @@ template struct __common_type_impl {}; -// Clang provides variadic templates in C++03 as an extension. -#if !defined(_LIBCPP_CXX03_LANG) || defined(__clang__) -# define _LIBCPP_OPTIONAL_PACK(...) , __VA_ARGS__ template struct __common_types; template struct _LIBCPP_TEMPLATE_VIS common_type; -#else -# define _LIBCPP_OPTIONAL_PACK(...) -struct __no_arg; -template -struct __common_types; -template -struct common_type { - static_assert(sizeof(_Unused) == 0, - "common_type accepts at most 3 arguments in C++03"); -}; -#endif // _LIBCPP_CXX03_LANG template struct __common_type_impl< @@ -84,12 +69,12 @@ typedef typename common_type<_Tp, _Up>::type type; }; -template +template struct __common_type_impl< - __common_types<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)>, + __common_types<_Tp, _Up, _Vp, _Rest...>, __void_t::type> > : __common_type_impl<__common_types::type, - _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)> > { + _Vp, _Rest...> > { }; // bullet 1 - sizeof...(Tp) == 0 @@ -117,13 +102,11 @@ // bullet 4 - sizeof...(Tp) > 2 -template +template struct _LIBCPP_TEMPLATE_VIS - common_type<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)> + common_type<_Tp, _Up, _Vp, _Rest...> : __common_type_impl< - __common_types<_Tp, _Up, _Vp _LIBCPP_OPTIONAL_PACK(_Rest...)> > {}; - -#undef _LIBCPP_OPTIONAL_PACK + __common_types<_Tp, _Up, _Vp, _Rest...> > {}; #if _LIBCPP_STD_VER >= 14 template using common_type_t = typename common_type<_Tp...>::type;