Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<xstring>: Strengthen exception specification for sv.compare("NTBS") #3738

Merged
merged 7 commits into from Jun 15, 2023
9 changes: 5 additions & 4 deletions stl/inc/xstring
Expand Up @@ -1399,7 +1399,8 @@ public:
return substr(_Off, _Nx).compare(_Right.substr(_Roff, _Count));
}

_NODISCARD constexpr int compare(_In_z_ const _Elem* const _Ptr) const { // compare [0, _Mysize) with [_Ptr, <null>)
_NODISCARD constexpr int compare(_In_z_ const _Elem* const _Ptr) const noexcept /* strengthened */ {
// compare [0, _Mysize) with [_Ptr, <null>)
return compare(basic_string_view(_Ptr));
}

Expand Down Expand Up @@ -4258,7 +4259,7 @@ public:
_Construct_in_place(_Starts_small._Bx._Ptr, _Ptr);
}

_CONSTEXPR20 void _Swap_data(basic_string& _Right) {
_CONSTEXPR20 void _Swap_data(basic_string& _Right) noexcept {
using _STD swap;

auto& _My_data = _Mypair._Myval2;
Expand Down Expand Up @@ -4810,7 +4811,7 @@ private:
_My_data._Myres = _BUF_SIZE - 1;
}

_CONSTEXPR20 void _Eos(const size_type _New_size) { // set new length and null terminator
_CONSTEXPR20 void _Eos(const size_type _New_size) noexcept { // set new length and null terminator
_ASAN_STRING_MODIFY(*this, _Mypair._Myval2._Mysize, _New_size);
_Traits::assign(_Mypair._Myval2._Myptr()[_Mypair._Myval2._Mysize = _New_size], _Elem());
}
Expand Down Expand Up @@ -4850,7 +4851,7 @@ public:
}

private:
_CONSTEXPR20 void _Swap_proxy_and_iterators(basic_string& _Right) {
_CONSTEXPR20 void _Swap_proxy_and_iterators(basic_string& _Right) noexcept {
_Mypair._Myval2._Swap_proxy_and_iterators(_Right._Mypair._Myval2);
}

Expand Down