mirror of
https://github.com/darlinghq/darling-libcxx.git
synced 2025-01-07 11:50:44 +00:00
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>
|
||||
struct __has_operator_addressof_member_imp
|
||||
{
|
||||
template <class>
|
||||
static auto __test(__any) -> false_type;
|
||||
template <class _Up>
|
||||
static auto __test(_Up* __u)
|
||||
-> typename __select_2nd<decltype(__u->operator&()), true_type>::type;
|
||||
static auto __test(int)
|
||||
-> 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>
|
||||
struct __has_operator_addressof_free_imp
|
||||
{
|
||||
template <class>
|
||||
static auto __test(__any) -> false_type;
|
||||
template <class _Up>
|
||||
static auto __test(_Up* __u)
|
||||
-> typename __select_2nd<decltype(operator&(*__u)), true_type>::type;
|
||||
static auto __test(int)
|
||||
-> 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>
|
||||
|
@ -41,9 +41,19 @@ struct E
|
||||
};
|
||||
|
||||
struct F {};
|
||||
|
||||
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
|
||||
|
||||
int main()
|
||||
@ -54,5 +64,8 @@ int main()
|
||||
static_assert(std::__has_operator_addressof<B>::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<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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user