Import libc+++ r198773. Fixes a bug in stdexcept I introduced when
removing C style casts.
This commit is contained in:
parent
7f23e64fd1
commit
a29e9d8555
|
@ -478,7 +478,7 @@ namespace std {
|
|||
}
|
||||
}
|
||||
|
||||
#endif // __clang__ || __GNUC___ || _MSC_VER || __IBMCPP__
|
||||
#endif // __clang__ || __GNUC__ || _MSC_VER || __IBMCPP__
|
||||
|
||||
#ifdef _LIBCPP_HAS_NO_UNICODE_CHARS
|
||||
typedef unsigned short char16_t;
|
||||
|
|
|
@ -451,10 +451,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class _Tp> struct ____is_reference_wrapper : public false_type {};
|
||||
template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
|
||||
template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
|
||||
template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
|
||||
template <class _Tp> struct __is_reference_wrapper
|
||||
: public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
|
||||
: public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
|
|
@ -1047,10 +1047,10 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
template <class _Tp> struct ____is_reference_wrapper : public false_type {};
|
||||
template <class _Tp> struct ____is_reference_wrapper<reference_wrapper<_Tp> > : public true_type {};
|
||||
template <class _Tp> struct __is_reference_wrapper_impl : public false_type {};
|
||||
template <class _Tp> struct __is_reference_wrapper_impl<reference_wrapper<_Tp> > : public true_type {};
|
||||
template <class _Tp> struct __is_reference_wrapper
|
||||
: public ____is_reference_wrapper<typename remove_cv<_Tp>::type> {};
|
||||
: public __is_reference_wrapper_impl<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
template <class _Tp>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
|
|
|
@ -419,25 +419,12 @@ __libcpp_isnan(_A1 __x) _NOEXCEPT
|
|||
|
||||
#undef isnan
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
isnan(float __x) _NOEXCEPT
|
||||
typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
|
||||
isnan(_A1 __x) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_isnan(__x);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
isnan(double __x) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_isnan(__x);
|
||||
}
|
||||
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
bool
|
||||
isnan(long double __x) _NOEXCEPT
|
||||
{
|
||||
return __libcpp_isnan(__x);
|
||||
return __libcpp_isnan((typename std::__promote<_A1>::type)__x);
|
||||
}
|
||||
|
||||
#endif // isnan
|
||||
|
@ -665,26 +652,6 @@ using ::isunordered;
|
|||
using ::float_t;
|
||||
using ::double_t;
|
||||
|
||||
// isnan
|
||||
|
||||
template <class _A1>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename std::enable_if<__promote<_A1>::value, bool>::type
|
||||
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
isnan(_A1 __x)
|
||||
#else
|
||||
isnan(_A1&& __x)
|
||||
_NOEXCEPT_
|
||||
(
|
||||
_NOEXCEPT_(__promote<_A1>::__does_not_throw)
|
||||
)
|
||||
#endif
|
||||
{
|
||||
typedef typename __promote<_A1>::type type;
|
||||
static_assert(!(is_same<typename remove_reference<_A1>::type, type>::value), "");
|
||||
return __libcpp_isnan(static_cast<type>(_VSTD::forward<_A1>(__x)));
|
||||
}
|
||||
|
||||
// abs
|
||||
|
||||
#if !defined(_AIX)
|
||||
|
@ -985,25 +952,18 @@ inline _LIBCPP_INLINE_VISIBILITY long double pow(long double __x, long double __
|
|||
|
||||
template <class _A1, class _A2>
|
||||
inline _LIBCPP_INLINE_VISIBILITY
|
||||
typename __promote<_A1, _A2>::type
|
||||
#ifdef _LIBCPP_HAS_NO_RVALUE_REFERENCES
|
||||
pow(_A1 __x, _A2 __y)
|
||||
#else
|
||||
pow(_A1&& __x, _A2&& __y)
|
||||
_NOEXCEPT_
|
||||
(
|
||||
_NOEXCEPT_(__promote<_A1>::__does_not_throw) &&
|
||||
_NOEXCEPT_(__promote<_A2>::__does_not_throw)
|
||||
)
|
||||
#endif
|
||||
typename enable_if
|
||||
<
|
||||
is_arithmetic<_A1>::value &&
|
||||
is_arithmetic<_A2>::value,
|
||||
typename __promote<_A1, _A2>::type
|
||||
>::type
|
||||
pow(_A1 __x, _A2 __y) _NOEXCEPT
|
||||
{
|
||||
typedef typename __promote<_A1>::type _D1;
|
||||
typedef typename __promote<_A2>::type _D2;
|
||||
typedef typename __promote<_D1, _D2>::type type;
|
||||
static_assert((!(is_same<typename remove_reference<_A1>::type, type>::value &&
|
||||
is_same<typename remove_reference<_A2>::type, type>::value)), "");
|
||||
return pow(static_cast<type>(static_cast<_D1>(_VSTD::forward<_A1>(__x))),
|
||||
static_cast<type>(static_cast<_D2>(_VSTD::forward<_A2>(__y))));
|
||||
typedef typename __promote<_A1, _A2>::type __result_type;
|
||||
static_assert((!(is_same<_A1, __result_type>::value &&
|
||||
is_same<_A2, __result_type>::value)), "");
|
||||
return pow((__result_type)__x, (__result_type)__y);
|
||||
}
|
||||
|
||||
// sin
|
||||
|
|
|
@ -364,10 +364,10 @@ public:
|
|||
static const bool value = sizeof(__test<_Tp>(0)) == 1;
|
||||
};
|
||||
|
||||
template <class _Iter, bool> struct ____iterator_traits {};
|
||||
template <class _Iter, bool> struct __iterator_traits_impl {};
|
||||
|
||||
template <class _Iter>
|
||||
struct ____iterator_traits<_Iter, true>
|
||||
struct __iterator_traits_impl<_Iter, true>
|
||||
{
|
||||
typedef typename _Iter::difference_type difference_type;
|
||||
typedef typename _Iter::value_type value_type;
|
||||
|
@ -380,7 +380,7 @@ template <class _Iter, bool> struct __iterator_traits {};
|
|||
|
||||
template <class _Iter>
|
||||
struct __iterator_traits<_Iter, true>
|
||||
: ____iterator_traits
|
||||
: __iterator_traits_impl
|
||||
<
|
||||
_Iter,
|
||||
is_convertible<typename _Iter::iterator_category, input_iterator_tag>::value ||
|
||||
|
|
|
@ -816,13 +816,13 @@ namespace { const __ignore_t<unsigned char> ignore = __ignore_t<unsigned char>()
|
|||
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper;
|
||||
|
||||
template <class _Tp>
|
||||
struct ___make_tuple_return
|
||||
struct __make_tuple_return_impl
|
||||
{
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct ___make_tuple_return<reference_wrapper<_Tp> >
|
||||
struct __make_tuple_return_impl<reference_wrapper<_Tp> >
|
||||
{
|
||||
typedef _Tp& type;
|
||||
};
|
||||
|
@ -830,7 +830,7 @@ struct ___make_tuple_return<reference_wrapper<_Tp> >
|
|||
template <class _Tp>
|
||||
struct __make_tuple_return
|
||||
{
|
||||
typedef typename ___make_tuple_return<typename decay<_Tp>::type>::type type;
|
||||
typedef typename __make_tuple_return_impl<typename decay<_Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class... _Tp>
|
||||
|
|
|
@ -293,15 +293,15 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_void
|
|||
|
||||
// __is_nullptr_t
|
||||
|
||||
template <class _Tp> struct ____is_nullptr_t : public false_type {};
|
||||
template <> struct ____is_nullptr_t<nullptr_t> : public true_type {};
|
||||
template <class _Tp> struct __is_nullptr_t_impl : public false_type {};
|
||||
template <> struct __is_nullptr_t_impl<nullptr_t> : public true_type {};
|
||||
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY __is_nullptr_t
|
||||
: public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};
|
||||
: public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
|
||||
|
||||
#if _LIBCPP_STD_VER > 11
|
||||
template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_null_pointer
|
||||
: public ____is_nullptr_t<typename remove_cv<_Tp>::type> {};
|
||||
: public __is_nullptr_t_impl<typename remove_cv<_Tp>::type> {};
|
||||
#endif
|
||||
|
||||
// is_integral
|
||||
|
@ -644,13 +644,13 @@ template <class _Tp> using add_pointer_t = typename add_pointer<_Tp>::type;
|
|||
// is_signed
|
||||
|
||||
template <class _Tp, bool = is_integral<_Tp>::value>
|
||||
struct ___is_signed : public integral_constant<bool, _Tp(-1) < _Tp(0)> {};
|
||||
struct __is_signed_impl : public integral_constant<bool, _Tp(-1) < _Tp(0)> {};
|
||||
|
||||
template <class _Tp>
|
||||
struct ___is_signed<_Tp, false> : public true_type {}; // floating point
|
||||
struct __is_signed_impl<_Tp, false> : public true_type {}; // floating point
|
||||
|
||||
template <class _Tp, bool = is_arithmetic<_Tp>::value>
|
||||
struct __is_signed : public ___is_signed<_Tp> {};
|
||||
struct __is_signed : public __is_signed_impl<_Tp> {};
|
||||
|
||||
template <class _Tp> struct __is_signed<_Tp, false> : public false_type {};
|
||||
|
||||
|
@ -659,13 +659,13 @@ template <class _Tp> struct _LIBCPP_TYPE_VIS_ONLY is_signed : public __is_signed
|
|||
// is_unsigned
|
||||
|
||||
template <class _Tp, bool = is_integral<_Tp>::value>
|
||||
struct ___is_unsigned : public integral_constant<bool, _Tp(0) < _Tp(-1)> {};
|
||||
struct __is_unsigned_impl : public integral_constant<bool, _Tp(0) < _Tp(-1)> {};
|
||||
|
||||
template <class _Tp>
|
||||
struct ___is_unsigned<_Tp, false> : public false_type {}; // floating point
|
||||
struct __is_unsigned_impl<_Tp, false> : public false_type {}; // floating point
|
||||
|
||||
template <class _Tp, bool = is_arithmetic<_Tp>::value>
|
||||
struct __is_unsigned : public ___is_unsigned<_Tp> {};
|
||||
struct __is_unsigned : public __is_unsigned_impl<_Tp> {};
|
||||
|
||||
template <class _Tp> struct __is_unsigned<_Tp, false> : public false_type {};
|
||||
|
||||
|
|
|
@ -465,13 +465,13 @@ swap(pair<_T1, _T2>& __x, pair<_T1, _T2>& __y)
|
|||
template <class _Tp> class _LIBCPP_TYPE_VIS_ONLY reference_wrapper;
|
||||
|
||||
template <class _Tp>
|
||||
struct ___make_pair_return
|
||||
struct __make_pair_return_impl
|
||||
{
|
||||
typedef _Tp type;
|
||||
};
|
||||
|
||||
template <class _Tp>
|
||||
struct ___make_pair_return<reference_wrapper<_Tp>>
|
||||
struct __make_pair_return_impl<reference_wrapper<_Tp>>
|
||||
{
|
||||
typedef _Tp& type;
|
||||
};
|
||||
|
@ -479,7 +479,7 @@ struct ___make_pair_return<reference_wrapper<_Tp>>
|
|||
template <class _Tp>
|
||||
struct __make_pair_return
|
||||
{
|
||||
typedef typename ___make_pair_return<typename decay<_Tp>::type>::type type;
|
||||
typedef typename __make_pair_return_impl<typename decay<_Tp>::type>::type type;
|
||||
};
|
||||
|
||||
template <class _T1, class _T2>
|
||||
|
|
|
@ -102,28 +102,28 @@ namespace std // purposefully not using versioning namespace
|
|||
|
||||
logic_error::logic_error(const string& msg)
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
::new(s) __libcpp_nmstr(msg.c_str());
|
||||
}
|
||||
|
||||
logic_error::logic_error(const char* msg)
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
::new(s) __libcpp_nmstr(msg);
|
||||
}
|
||||
|
||||
logic_error::logic_error(const logic_error& le) _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_);
|
||||
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
|
||||
::new(s) __libcpp_nmstr(*s2);
|
||||
}
|
||||
|
||||
logic_error&
|
||||
logic_error::operator=(const logic_error& le) _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr *s1 = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_);
|
||||
__libcpp_nmstr *s1 = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
|
||||
*s1 = *s2;
|
||||
return *this;
|
||||
}
|
||||
|
@ -132,14 +132,14 @@ logic_error::operator=(const logic_error& le) _NOEXCEPT
|
|||
|
||||
logic_error::~logic_error() _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
s->~__libcpp_nmstr();
|
||||
}
|
||||
|
||||
const char*
|
||||
logic_error::what() const _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
const __libcpp_nmstr *s = reinterpret_cast<const __libcpp_nmstr *>(&__imp_);
|
||||
return s->c_str();
|
||||
}
|
||||
|
||||
|
@ -147,28 +147,28 @@ logic_error::what() const _NOEXCEPT
|
|||
|
||||
runtime_error::runtime_error(const string& msg)
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
::new(s) __libcpp_nmstr(msg.c_str());
|
||||
}
|
||||
|
||||
runtime_error::runtime_error(const char* msg)
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
::new(s) __libcpp_nmstr(msg);
|
||||
}
|
||||
|
||||
runtime_error::runtime_error(const runtime_error& le) _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_);
|
||||
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
|
||||
::new(s) __libcpp_nmstr(*s2);
|
||||
}
|
||||
|
||||
runtime_error&
|
||||
runtime_error::operator=(const runtime_error& le) _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr *s1 = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
const __libcpp_nmstr *s2 = static_cast<const __libcpp_nmstr *>(le.__imp_);
|
||||
__libcpp_nmstr *s1 = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
const __libcpp_nmstr *s2 = reinterpret_cast<const __libcpp_nmstr *>(&le.__imp_);
|
||||
*s1 = *s2;
|
||||
return *this;
|
||||
}
|
||||
|
@ -177,14 +177,14 @@ runtime_error::operator=(const runtime_error& le) _NOEXCEPT
|
|||
|
||||
runtime_error::~runtime_error() _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
__libcpp_nmstr *s = reinterpret_cast<__libcpp_nmstr *>(&__imp_);
|
||||
s->~__libcpp_nmstr();
|
||||
}
|
||||
|
||||
const char*
|
||||
runtime_error::what() const _NOEXCEPT
|
||||
{
|
||||
__libcpp_nmstr *s = static_cast<__libcpp_nmstr *>(__imp_);
|
||||
const __libcpp_nmstr *s = reinterpret_cast<const __libcpp_nmstr *>(&__imp_);
|
||||
return s->c_str();
|
||||
}
|
||||
|
||||
|
|
|
@ -339,14 +339,14 @@ void test_pow()
|
|||
static_assert((std::is_same<decltype(std::powf(0,0)), float>::value), "");
|
||||
static_assert((std::is_same<decltype(std::powl(0,0)), long double>::value), "");
|
||||
static_assert((std::is_same<decltype(std::pow((int)0, (int)0)), double>::value), "");
|
||||
static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), "");
|
||||
static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), "");
|
||||
static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), "");
|
||||
// static_assert((std::is_same<decltype(std::pow(Value<int>(), (int)0)), double>::value), "");
|
||||
// static_assert((std::is_same<decltype(std::pow(Value<long double>(), (float)0)), long double>::value), "");
|
||||
// static_assert((std::is_same<decltype(std::pow((float) 0, Value<float>())), float>::value), "");
|
||||
assert(std::pow(1,1) == 1);
|
||||
assert(std::pow(Value<int,1>(), Value<float,1>()) == 1);
|
||||
assert(std::pow(1.0f, Value<double,1>()) == 1);
|
||||
assert(std::pow(1.0, Value<int,1>()) == 1);
|
||||
assert(std::pow(Value<long double,1>(), 1LL) == 1);
|
||||
// assert(std::pow(Value<int,1>(), Value<float,1>()) == 1);
|
||||
// assert(std::pow(1.0f, Value<double,1>()) == 1);
|
||||
// assert(std::pow(1.0, Value<int,1>()) == 1);
|
||||
// assert(std::pow(Value<long double,1>(), 1LL) == 1);
|
||||
}
|
||||
|
||||
void test_sin()
|
||||
|
|
Loading…
Reference in New Issue