diff --git a/stl/inc/chrono b/stl/inc/chrono index f8cb5a98746..d57acea0a2e 100644 --- a/stl/inc/chrono +++ b/stl/inc/chrono @@ -5293,14 +5293,14 @@ namespace chrono { if constexpr (_Is_specialization_v<_Ty, duration>) { if constexpr (!treat_as_floating_point_v) { if (_Specs._Precision != -1) { - _THROW(format_error("Precision specification invalid for chrono::duration type with " - "integral representation type, see N4950 [time.format]/1.")); + _Throw_format_error("Precision specification invalid for chrono::duration type with " + "integral representation type, see N4950 [time.format]/1."); } } } else { if (_Specs._Precision != -1) { - _THROW(format_error("Precision specification invalid for non-chrono::duration type, " - "see N4950 [time.format]/1.")); + _Throw_format_error("Precision specification invalid for non-chrono::duration type, " + "see N4950 [time.format]/1."); } } @@ -5747,8 +5747,7 @@ namespace chrono { return true; } else if constexpr (is_same_v<_Ty, month_day_last>) { if (_Val.month() >= February) { - _THROW( - format_error("The day of year for a month_day_last other than January is ambiguous")); + _Throw_format_error("The day of year for a month_day_last other than January is ambiguous"); } return true; } else if constexpr (_Is_ymd) { diff --git a/stl/inc/exception b/stl/inc/exception index 72bf3d74edf..afda3fb4b21 100644 --- a/stl/inc/exception +++ b/stl/inc/exception @@ -253,12 +253,6 @@ public: return __ExceptionPtrToBool(this); } - static exception_ptr _Current_exception() noexcept { - exception_ptr _Retval; - __ExceptionPtrCurrentException(&_Retval); - return _Retval; - } - static exception_ptr _Copy_exception(_In_ void* _Except, _In_ const void* _Ptr) { exception_ptr _Retval; if (!_Ptr) { @@ -312,7 +306,9 @@ private: }; _EXPORT_STD _NODISCARD inline exception_ptr current_exception() noexcept { - return exception_ptr::_Current_exception(); + exception_ptr _Retval; + __ExceptionPtrCurrentException(&_Retval); + return _Retval; } _EXPORT_STD [[noreturn]] inline void rethrow_exception(_In_ exception_ptr _Ptr) { @@ -327,10 +323,6 @@ _NODISCARD_SMART_PTR_ALLOC exception_ptr make_exception_ptr(_Ex _Except) noexcep return exception_ptr::_Copy_exception(_STD addressof(_Except), __GetExceptionInfo(_Except)); } -[[noreturn]] inline void _Throw_bad_array_new_length() { - _THROW(bad_array_new_length{}); -} - _EXPORT_STD class nested_exception { // wrap an exception_ptr public: nested_exception() noexcept : _Exc(_STD current_exception()) {} @@ -355,9 +347,10 @@ private: exception_ptr _Exc; }; -template -struct _With_nested : _Uty, nested_exception { // glue user exception to nested_exception - explicit _With_nested(_Ty&& _Arg) +template +struct _With_nested_v2 : _Uty, nested_exception { // glue user exception to nested_exception + template + explicit _With_nested_v2(_Ty&& _Arg) : _Uty(_STD forward<_Ty>(_Arg)), nested_exception() {} // store user exception and current_exception() }; @@ -368,7 +361,7 @@ _EXPORT_STD template if constexpr (is_class_v<_Uty> && !is_base_of_v && !is_final_v<_Uty>) { // throw user exception glued to nested_exception - using _Glued = _With_nested<_Ty, _Uty>; + using _Glued = _With_nested_v2<_Uty>; _THROW(_Glued(_STD forward<_Ty>(_Arg))); } else { // throw user exception by itself diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 75c315c4477..a612d99d103 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -60,6 +60,10 @@ template _INLINE_VAR constexpr bool _Nothrow_compare = noexcept( static_cast(_STD declval()(_STD declval(), _STD declval()))); +[[noreturn]] inline void _Throw_bad_array_new_length() { + _THROW(bad_array_new_length{}); +} + template _NODISCARD constexpr size_t _Get_size_of_n(const size_t _Count) { constexpr bool _Overflow_is_possible = _Ty_size > 1;