diff --git a/stl/inc/atomic b/stl/inc/atomic index 75e45dde4a0..929fcd7c26d 100644 --- a/stl/inc/atomic +++ b/stl/inc/atomic @@ -2990,7 +2990,8 @@ public: break; default: // Unrecognized bit pattern - _CSTD abort(); + _STL_REPORT_ERROR("atomic shared_ptr invariant broken"); + break; } } } diff --git a/stl/inc/format b/stl/inc/format index 2d81e60ce56..0e6af0261bb 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -3540,7 +3540,7 @@ _NODISCARD _FormatContext::iterator _Tuple_formatter_format(const tuple(_Tmp_str); diff --git a/stl/inc/functional b/stl/inc/functional index 21c0e80ccc7..6496b8d3dff 100644 --- a/stl/inc/functional +++ b/stl/inc/functional @@ -770,7 +770,8 @@ private: auto& _Myax = _Mypair._Get_first(); if constexpr (!is_copy_constructible_v<_Callable>) { // used exclusively for packaged_task (void) _Myax; - _CSTD abort(); // shouldn't be called, see GH-3888 + _STL_REPORT_ERROR("this callable object should not be copied"); + return nullptr; } else if constexpr (_Is_large<_Func_impl>) { _Myalty _Rebound(_Myax); _Alloc_construct_ptr<_Myalty> _Constructor{_Rebound}; @@ -808,7 +809,8 @@ private: } #else // ^^^ _HAS_STATIC_RTTI / !_HAS_STATIC_RTTI vvv [[noreturn]] const type_info& _Target_type() const noexcept override { - _CSTD abort(); // shouldn't be called, see GH-3888 + _STL_REPORT_ERROR("type info is disabled"); + _STL_UNREACHABLE; // no return value available for "continue on error" } #endif // ^^^ !_HAS_STATIC_RTTI ^^^ @@ -859,7 +861,8 @@ public: private: _Mybase* _Copy(void* _Where) const override { if constexpr (!is_copy_constructible_v<_Callable>) { // used exclusively for packaged_task - _CSTD abort(); // shouldn't be called, see GH-3888 + _STL_REPORT_ERROR("this callable object should not be copied"); + return nullptr; } else if constexpr (_Is_large<_Func_impl_no_alloc>) { return _STD _Global_new<_Func_impl_no_alloc>(_Callee); } else { @@ -889,7 +892,8 @@ private: } #else // ^^^ _HAS_STATIC_RTTI / !_HAS_STATIC_RTTI vvv [[noreturn]] const type_info& _Target_type() const noexcept override { - _CSTD abort(); // shouldn't be called, see GH-3888 + _STL_REPORT_ERROR("type info is disabled"); + _STL_UNREACHABLE; // no return value available for "continue on error" } #endif // ^^^ !_HAS_STATIC_RTTI ^^^ @@ -1352,8 +1356,8 @@ inline constexpr size_t _Minimum_function_size = 2 * sizeof(void*); template [[noreturn]] _Rx __stdcall _Function_not_callable(const _Move_only_function_data&, _Types&&...) noexcept { - _CSTD abort(); // Unlike std::function, move_only_function doesn't throw bad_function_call - // (N4950 [func.wrap.move.inv]/2) + _STL_REPORT_ERROR("empty move_only_function call (N5008 [func.wrap.move.inv]/2)"); + _STL_UNREACHABLE; // no return value available for "continue on error" } template diff --git a/stl/inc/future b/stl/inc/future index 135fa8fecdd..318427ba744 100644 --- a/stl/inc/future +++ b/stl/inc/future @@ -1319,7 +1319,7 @@ template class _Fake_no_copy_callable_adapter { // async() is built on packaged_task internals which incorrectly use // std::function, which requires that things be copyable. We can't fix this in an - // update, so this adapter turns copies into abort(). When VSO-153581 is + // update, so this adapter turns copies into _STL_REPORT_ERROR(). When VSO-153581 is // fixed, remove this adapter. private: using _Storaget = tuple...>; @@ -1331,7 +1331,7 @@ public: [[noreturn]] _Fake_no_copy_callable_adapter(const _Fake_no_copy_callable_adapter& _Other) : _Storage(_STD move(_Other._Storage)) { - _CSTD abort(); // shouldn't be called + _STL_REPORT_ERROR("this callable object should not be copied"); // shouldn't be called } _Fake_no_copy_callable_adapter(_Fake_no_copy_callable_adapter&& _Other) = default; diff --git a/stl/inc/memory b/stl/inc/memory index e959623f7b4..74d85f4e56e 100644 --- a/stl/inc/memory +++ b/stl/inc/memory @@ -1128,11 +1128,11 @@ private: #ifdef _M_CEE_PURE // permanent workaround to avoid mentioning _purecall in msvcurt.lib, ptrustu.lib, or other support libs virtual void _Destroy() noexcept { - _CSTD abort(); + _STL_REPORT_ERROR("_Ref_count_base base class member functions should not be called"); } virtual void _Delete_this() noexcept { - _CSTD abort(); + _STL_REPORT_ERROR("_Ref_count_base base class member functions should not be called"); } #else // ^^^ defined(_M_CEE_PURE) / !defined(_M_CEE_PURE) vvv virtual void _Destroy() noexcept = 0; // destroy managed resource diff --git a/stl/inc/utility b/stl/inc/utility index 4570a7bb790..326b5f8978b 100644 --- a/stl/inc/utility +++ b/stl/inc/utility @@ -958,9 +958,6 @@ _NODISCARD constexpr underlying_type_t<_Ty> to_underlying(_Ty _Value) noexcept { _EXPORT_STD [[noreturn]] __forceinline void unreachable() noexcept /* strengthened */ { _STL_UNREACHABLE; -#ifdef _DEBUG - _CSTD abort(); // likely to be called in debug mode, but can't be relied upon - already entered the UB territory -#endif // defined(_DEBUG) } template (_Psave); diff --git a/stl/inc/xutility b/stl/inc/xutility index 46c9bef18b1..dbfbad6ce35 100644 --- a/stl/inc/xutility +++ b/stl/inc/xutility @@ -1121,7 +1121,8 @@ struct _Projected_impl { using value_type = remove_cvref_t>; [[noreturn]] indirect_result_t<_Proj&, _It> operator*() const { - _CSTD abort(); // shouldn't be called, see GH-3888 + _STL_REPORT_ERROR("std::projected::operator*() can't be called (N5008 [projected]/1)"); + _STL_UNREACHABLE; // no return value available for "continue on error" } }; }; diff --git a/stl/inc/yvals.h b/stl/inc/yvals.h index a1ebe2fd072..a971b51fb29 100644 --- a/stl/inc/yvals.h +++ b/stl/inc/yvals.h @@ -253,7 +253,9 @@ _EMIT_STL_ERROR(STL1008, "_STL_CALL_ABORT_INSTEAD_OF_INVALID_PARAMETER has been #define _MSVC_STL_DOOM_FUNCTION(mesg) ::_invoke_watson(nullptr, nullptr, nullptr, 0, 0) #else // Use the MSVC __fastfail intrinsic: extern "C" __declspec(noreturn) void __fastfail(unsigned int); // declared by -#define _MSVC_STL_DOOM_FUNCTION(mesg) __fastfail(5) // __fastfail(FAST_FAIL_INVALID_ARG), value defined by +#define _MSVC_STL_DOOM_FUNCTION(mesg) \ + __fastfail(5); /* __fastfail(FAST_FAIL_INVALID_ARG), value defined by */ \ + _STL_UNREACHABLE /* TRANSITION, DevCom-10914110 */ #endif // choose "doom function" #endif // ^^^ !defined(_MSVC_STL_DOOM_FUNCTION) ^^^