Fix rvalue bug in __has_operator_addressof
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@221398 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
341b59021c
commit
b6e0ef2deb
@ -3644,25 +3644,25 @@ struct underlying_type
|
|||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
struct __has_operator_addressof_member_imp
|
struct __has_operator_addressof_member_imp
|
||||||
{
|
{
|
||||||
template <class>
|
|
||||||
static auto __test(__any) -> false_type;
|
|
||||||
template <class _Up>
|
template <class _Up>
|
||||||
static auto __test(_Up* __u)
|
static auto __test(int)
|
||||||
-> typename __select_2nd<decltype(__u->operator&()), true_type>::type;
|
-> typename __select_2nd<decltype(_VSTD::declval<_Up>().operator&()), true_type>::type;
|
||||||
|
template <class>
|
||||||
|
static auto __test(long) -> false_type;
|
||||||
|
|
||||||
static const bool value = decltype(__test<_Tp>(nullptr))::value;
|
static const bool value = decltype(__test<_Tp>(0))::value;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
struct __has_operator_addressof_free_imp
|
struct __has_operator_addressof_free_imp
|
||||||
{
|
{
|
||||||
template <class>
|
|
||||||
static auto __test(__any) -> false_type;
|
|
||||||
template <class _Up>
|
template <class _Up>
|
||||||
static auto __test(_Up* __u)
|
static auto __test(int)
|
||||||
-> typename __select_2nd<decltype(operator&(*__u)), true_type>::type;
|
-> typename __select_2nd<decltype(operator&(_VSTD::declval<_Up>())), true_type>::type;
|
||||||
|
template <class>
|
||||||
|
static auto __test(long) -> false_type;
|
||||||
|
|
||||||
static const bool value = decltype(__test<_Tp>(nullptr))::value;
|
static const bool value = decltype(__test<_Tp>(0))::value;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class _Tp>
|
template <class _Tp>
|
||||||
|
@ -41,9 +41,19 @@ struct E
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct F {};
|
struct F {};
|
||||||
|
|
||||||
constexpr F* operator&(F const &) { return nullptr; }
|
constexpr F* operator&(F const &) { return nullptr; }
|
||||||
|
|
||||||
|
struct G {};
|
||||||
|
constexpr G* operator&(G &&) { return nullptr; }
|
||||||
|
|
||||||
|
struct H {};
|
||||||
|
constexpr H* operator&(H const &&) { return nullptr; }
|
||||||
|
|
||||||
|
struct J
|
||||||
|
{
|
||||||
|
constexpr J* operator&() &&;
|
||||||
|
};
|
||||||
|
|
||||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
@ -54,5 +64,8 @@ int main()
|
|||||||
static_assert(std::__has_operator_addressof<B>::value == true, "");
|
static_assert(std::__has_operator_addressof<B>::value == true, "");
|
||||||
static_assert(std::__has_operator_addressof<E>::value == true, "");
|
static_assert(std::__has_operator_addressof<E>::value == true, "");
|
||||||
static_assert(std::__has_operator_addressof<F>::value == true, "");
|
static_assert(std::__has_operator_addressof<F>::value == true, "");
|
||||||
|
static_assert(std::__has_operator_addressof<G>::value == true, "");
|
||||||
|
static_assert(std::__has_operator_addressof<H>::value == true, "");
|
||||||
|
static_assert(std::__has_operator_addressof<J>::value == true, "");
|
||||||
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
#endif // _LIBCPP_HAS_NO_CONSTEXPR
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user