[libcxx] r299901 - Fix PR#32605: common_type<T> is not SFINAE-friendly
Marshall Clow via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 10 16:47:48 PDT 2017
Author: marshall
Date: Mon Apr 10 18:47:47 2017
New Revision: 299901
URL: http://llvm.org/viewvc/llvm-project?rev=299901&view=rev
Log:
Fix PR#32605: common_type<T> is not SFINAE-friendly
Modified:
libcxx/trunk/include/type_traits
libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
Modified: libcxx/trunk/include/type_traits
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/type_traits?rev=299901&r1=299900&r2=299901&view=diff
==============================================================================
--- libcxx/trunk/include/type_traits (original)
+++ libcxx/trunk/include/type_traits Mon Apr 10 18:47:47 2017
@@ -1998,9 +1998,7 @@ struct _LIBCPP_TEMPLATE_VIS common_type
template <class _Tp>
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
Modified: libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp?rev=299901&r1=299900&r2=299901&view=diff
==============================================================================
--- libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp (original)
+++ libcxx/trunk/test/std/utilities/meta/meta.trans/meta.trans.other/common_type.pass.cpp Mon Apr 10 18:47:47 2017
@@ -45,6 +45,8 @@ namespace std
template <> struct common_type< ::S<long>, 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
@@ -304,5 +306,7 @@ int main()
static_assert((std::is_same<std::common_type<const int, 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(no_common_type<X<float> >::value, "");
+ static_assert(no_common_type<X<double> >::value, "");
}
More information about the cfe-commits
mailing list