Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion stl/inc/xstring
Original file line number Diff line number Diff line change
Expand Up @@ -3972,9 +3972,10 @@ public:
const auto _Result_size = _STD move(_Op)(_Mypair._Myval2._Myptr(), _New_size);
#if _CONTAINER_DEBUG_LEVEL > 0
_STL_VERIFY(_Result_size >= 0, "the returned size can't be smaller than 0");
#pragma warning(suppress : 4018) // '<=': signed/unsigned mismatch, we already compared with 0, so it's safe
_STL_VERIFY(_Result_size <= _New_size, "the returned size can't be greater than the passed size");
#endif // _CONTAINER_DEBUG_LEVEL > 0
_Eos(_Result_size);
_Eos(static_cast<size_type>(_Result_size));
}
#endif // _HAS_CXX23

Expand Down
13 changes: 13 additions & 0 deletions tests/std/tests/P0980R1_constexpr_strings/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,19 @@ constexpr void test_all() {
static_assert(test_allocator_awareness<CharType>());
}

#if _HAS_CXX23
void test_gh_2524() // COMPILE-ONLY
{
Comment on lines +2387 to +2388
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No change requested (mega-nitpick, not worth resetting testing): This brace should be attached to the function. (clang-format would ordinarily fix this, but it's inhibited from doing so by the comment.)

// resize_and_overwrite generates warning C4018 when Operation returns int
string s;
s.resize_and_overwrite(1, [](char* buffer, size_t) {
*buffer = 'x';
int i = 1;
return i;
});
}
#endif // _HAS_CXX23

int main() {
test_all<char>();
#ifdef __cpp_char8_t
Expand Down