Skip to content

Commit 0f61b6b

Browse files
authored
<format>: Use _STL_INTERNAL_CHECK for calls of to_chars (#3697)
These `to_chars` should never fail unless there's a bug in the implementation, so it's more appropriate to use `_STL_INTERNAL_CHECK`.
1 parent d95d3bb commit 0f61b6b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stl/inc/format

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2417,7 +2417,7 @@ inline namespace __p2286 {
24172417

24182418
if (_End == _Buffer) {
24192419
const to_chars_result _Result = _STD to_chars(_Buffer, _STD end(_Buffer), _Value);
2420-
_STL_ASSERT(_Result.ec == errc{}, "to_chars failed");
2420+
_STL_INTERNAL_CHECK(_Result.ec == errc{});
24212421
_End = _Result.ptr;
24222422
}
24232423

@@ -2444,7 +2444,7 @@ inline namespace __p2286 {
24442444
// TRANSITION, Reusable buffer
24452445
char _Buffer[_Format_min_buffer_length];
24462446
const auto [_End, _Ec] = _STD to_chars(_Buffer, _STD end(_Buffer), reinterpret_cast<uintptr_t>(_Value), 16);
2447-
_STL_ASSERT(_Ec == errc{}, "to_chars failed");
2447+
_STL_INTERNAL_CHECK(_Ec == errc{});
24482448
*_Out++ = '0';
24492449
*_Out++ = 'x';
24502450
return _Widen_and_copy<_CharT>(_Buffer, _End, _STD move(_Out));
@@ -2710,7 +2710,7 @@ inline namespace __p2286 {
27102710
// long long -1 representation in binary is 64 bits + sign
27112711
char _Buffer[65];
27122712
const auto [_End, _Ec] = _STD to_chars(_Buffer, _STD end(_Buffer), _Value, _Base);
2713-
_STL_ASSERT(_Ec == errc{}, "to_chars failed");
2713+
_STL_INTERNAL_CHECK(_Ec == errc{});
27142714

27152715
auto _Buffer_start = _Buffer;
27162716
auto _Width = static_cast<int>(_End - _Buffer_start);
@@ -2916,7 +2916,7 @@ inline namespace __p2286 {
29162916
_Result = _STD to_chars(_Buffer, _STD end(_Buffer), _Value, _Format, _Precision);
29172917
}
29182918

2919-
_STL_ASSERT(_Result.ec == errc{}, "to_chars failed");
2919+
_STL_INTERNAL_CHECK(_Result.ec == errc{});
29202920
}
29212921

29222922
auto _Buffer_start = _Buffer;

0 commit comments

Comments
 (0)