diff --git a/include/type_traits b/include/type_traits index ec158fc08..c0922392a 100644 --- a/include/type_traits +++ b/include/type_traits @@ -1998,9 +1998,7 @@ struct _LIBCPP_TEMPLATE_VIS common_type {}; template struct _LIBCPP_TEMPLATE_VIS common_type<_Tp> -{ - typedef typename common_type<_Tp, _Tp>::type type; -}; + : public common_type<_Tp, _Tp> {}; // bullet 3 - sizeof...(Tp) == 2 diff --git a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp index 736f74b4c..db7b4c2f4 100644 --- a/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp +++ b/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp @@ -45,6 +45,8 @@ namespace std template <> struct common_type< ::S, long> {}; template <> struct common_type > {}; + template <> struct common_type<::X > {}; + template <> struct common_type<::X, ::X > {}; } #if TEST_STD_VER >= 11 @@ -304,5 +306,7 @@ int main() static_assert((std::is_same::type, int>::value), ""); static_assert((std::is_same::type, int>::value), ""); static_assert((std::is_same::type, int>::value), ""); - + + static_assert(no_common_type >::value, ""); + static_assert(no_common_type >::value, ""); }