Fix PR#32605: common_type<T> is not SFINAE-friendly
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@299901 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -1998,9 +1998,7 @@ struct _LIBCPP_TEMPLATE_VIS common_type {};
|
|||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>
|
struct _LIBCPP_TEMPLATE_VIS common_type<_Tp>
|
||||||
{
|
: public common_type<_Tp, _Tp> {};
|
||||||
typedef typename common_type<_Tp, _Tp>::type type;
|
|
||||||
};
|
|
||||||
|
|
||||||
// bullet 3 - sizeof...(Tp) == 2
|
// bullet 3 - sizeof...(Tp) == 2
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ namespace std
|
|||||||
|
|
||||||
template <> struct common_type< ::S<long>, long> {};
|
template <> struct common_type< ::S<long>, long> {};
|
||||||
template <> struct common_type<long, ::S<long> > {};
|
template <> struct common_type<long, ::S<long> > {};
|
||||||
|
template <> struct common_type<::X<float> > {};
|
||||||
|
template <> struct common_type<::X<double>, ::X<double> > {};
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TEST_STD_VER >= 11
|
#if TEST_STD_VER >= 11
|
||||||
@@ -305,4 +307,6 @@ int main()
|
|||||||
static_assert((std::is_same<std::common_type<int, const int>::type, int>::value), "");
|
static_assert((std::is_same<std::common_type<int, const int>::type, int>::value), "");
|
||||||
static_assert((std::is_same<std::common_type<const int, const int>::type, int>::value), "");
|
static_assert((std::is_same<std::common_type<const int, const int>::type, int>::value), "");
|
||||||
|
|
||||||
|
static_assert(no_common_type<X<float> >::value, "");
|
||||||
|
static_assert(no_common_type<X<double> >::value, "");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user