Pull in r209785 from upstream libc++ trunk (by Marshall Clow):

Fix a problem exposed by r208825, which caused bind (and other bits of
  libc++) to stop working. And tests

This fix is needed to support clang 3.5.0 and higher, which are more
strict about forming pointer-to-function types with cv-qualifiers or
ref-qualifiers.  See also the upstream PR <http://llvm.org/PR19742> and
<http://llvm.org/viewvc/llvm-project?rev=208825&view=rev>

Reported by:	amdmi3
MFC after:	3 days
This commit is contained in:
dim 2014-12-01 15:02:49 +00:00
parent 792faf0761
commit e07a0f7cd7

View File

@ -439,8 +439,26 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_function
// is_member_function_pointer
template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {};
template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
// template <class _Tp> struct __libcpp_is_member_function_pointer : public false_type {};
// template <class _Tp, class _Up> struct __libcpp_is_member_function_pointer<_Tp _Up::*> : public is_function<_Tp> {};
//
template <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr>
struct __member_pointer_traits_imp
{ // forward declaration; specializations later
};
namespace __libcpp_is_member_function_pointer_imp {
template <typename _Tp>
char __test(typename std::__member_pointer_traits_imp<_Tp, true, false>::_FnType *);
template <typename>
std::__two __test(...);
};
template <class _Tp> struct __libcpp_is_member_function_pointer
: public integral_constant<bool, sizeof(__libcpp_is_member_function_pointer_imp::__test<_Tp>(nullptr)) == 1> {};
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_member_function_pointer
: public __libcpp_is_member_function_pointer<typename remove_cv<_Tp>::type> {};
@ -1593,11 +1611,6 @@ __decay_copy(const _Tp& __t)
#endif
template <class _MP, bool _IsMemberFuctionPtr, bool _IsMemberObjectPtr>
struct __member_pointer_traits_imp
{
};
#ifndef _LIBCPP_HAS_NO_VARIADICS
template <class _Rp, class _Class, class ..._Param>
@ -1605,6 +1618,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...), true, false>
{
typedef _Class _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1612,6 +1626,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const, true, false
{
typedef _Class const _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1619,6 +1634,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile, true, fa
{
typedef _Class volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1626,6 +1642,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile, tr
{
typedef _Class const volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
#if __has_feature(cxx_reference_qualified_functions)
@ -1635,6 +1652,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &, true, false>
{
typedef _Class& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1642,6 +1660,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&, true, fals
{
typedef _Class const& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1649,6 +1668,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&, true, f
{
typedef _Class volatile& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1656,6 +1676,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&, t
{
typedef _Class const volatile& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1663,6 +1684,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) &&, true, false>
{
typedef _Class&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1670,6 +1692,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const&&, true, fal
{
typedef _Class const&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1677,6 +1700,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) volatile&&, true,
{
typedef _Class volatile&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
template <class _Rp, class _Class, class ..._Param>
@ -1684,6 +1708,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_Param...) const volatile&&,
{
typedef _Class const volatile&& _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_Param...);
};
#endif // __has_feature(cxx_reference_qualified_functions)
@ -1695,6 +1720,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(), true, false>
{
typedef _Class _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) ();
};
template <class _Rp, class _Class, class _P0>
@ -1702,6 +1728,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0), true, false>
{
typedef _Class _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0);
};
template <class _Rp, class _Class, class _P0, class _P1>
@ -1709,6 +1736,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1), true, false>
{
typedef _Class _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0, _P1);
};
template <class _Rp, class _Class, class _P0, class _P1, class _P2>
@ -1716,6 +1744,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2), true, false>
{
typedef _Class _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0, _P1, _P2);
};
template <class _Rp, class _Class>
@ -1723,6 +1752,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)() const, true, false>
{
typedef _Class const _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) ();
};
template <class _Rp, class _Class, class _P0>
@ -1730,6 +1760,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const, true, false>
{
typedef _Class const _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0);
};
template <class _Rp, class _Class, class _P0, class _P1>
@ -1737,6 +1768,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const, true, false>
{
typedef _Class const _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0, _P1);
};
template <class _Rp, class _Class, class _P0, class _P1, class _P2>
@ -1744,6 +1776,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const, true, f
{
typedef _Class const _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0, _P1, _P2);
};
template <class _Rp, class _Class>
@ -1751,6 +1784,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)() volatile, true, false>
{
typedef _Class volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) ();
};
template <class _Rp, class _Class, class _P0>
@ -1758,6 +1792,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) volatile, true, false>
{
typedef _Class volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0);
};
template <class _Rp, class _Class, class _P0, class _P1>
@ -1765,6 +1800,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) volatile, true, fal
{
typedef _Class volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0, _P1);
};
template <class _Rp, class _Class, class _P0, class _P1, class _P2>
@ -1772,6 +1808,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) volatile, true
{
typedef _Class volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0, _P1, _P2);
};
template <class _Rp, class _Class>
@ -1779,6 +1816,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)() const volatile, true, false
{
typedef _Class const volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) ();
};
template <class _Rp, class _Class, class _P0>
@ -1786,6 +1824,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0) const volatile, true, fa
{
typedef _Class const volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0);
};
template <class _Rp, class _Class, class _P0, class _P1>
@ -1793,6 +1832,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1) const volatile, tru
{
typedef _Class const volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0, _P1);
};
template <class _Rp, class _Class, class _P0, class _P1, class _P2>
@ -1800,6 +1840,7 @@ struct __member_pointer_traits_imp<_Rp (_Class::*)(_P0, _P1, _P2) const volatile
{
typedef _Class const volatile _ClassType;
typedef _Rp _ReturnType;
typedef _Rp (_FnType) (_P0, _P1, _P2);
};
#endif // _LIBCPP_HAS_NO_VARIADICS
@ -1819,6 +1860,7 @@ struct __member_pointer_traits
{
// typedef ... _ClassType;
// typedef ... _ReturnType;
// typedef ... _FnType;
};
// result_of
@ -2526,6 +2568,15 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_trivially_destructible
// is_nothrow_constructible
#if 0
template <class _Tp, class... _Args>
struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible
: public integral_constant<bool, __is_nothrow_constructible(_Tp(_Args...))>
{
};
#else
#ifndef _LIBCPP_HAS_NO_VARIADICS
#if __has_feature(cxx_noexcept)
@ -2664,6 +2715,7 @@ struct _LIBCPP_TYPE_VIS_ONLY is_nothrow_constructible<_Tp, _Tp&,
};
#endif // _LIBCPP_HAS_NO_VARIADICS
#endif // __has_feature(is_nothrow_constructible)
// is_nothrow_default_constructible