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
Implement LWG-3778 vector<bool>
missing exception specifications
#3332
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment nit that I'll apply. (Oops - I missed "approve".)
@@ -2931,7 +2926,8 @@ public: | |||
this->_Swap_proxy_and_iterators(_Right); | |||
} | |||
|
|||
_CONSTEXPR20 vector& operator=(vector&& _Right) noexcept(is_nothrow_move_assignable_v<_Mybase>) { | |||
_CONSTEXPR20 vector& operator=(vector&& _Right) noexcept( | |||
_Choose_pocma_v<_Alvbase> != _Pocma_values::_No_propagate_allocators) { | |||
if (this == _STD addressof(_Right)) { | |||
return *this; | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For other reviewers: vector<bool>::swap
is already unconditionally noexcept
with a strengthened
comment in our implementation. We were previously strengthening from nothing to unconditional, after LWG-3778 we're strengthening from conditional to unconditional because we still aren't interested in throwing on precondition violation. (No change requested.)
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for implementing this LWG issue resolution in everyone's favorite partial specialization! 😻 👻 ✅ |
Fixes #3226.
Notes:
vector<bool, _Alloc>
need to default-construct an_Alloc
instead of_Alvbase
in order to implement the required exception specification. I think this is not related to allocator propagation and thus possibly not covered by LWG-3267.P1004R2_constexpr_vector_bool
due to this. Not sure whether such change is right now..._Vb_val
from an allocator is alwaysnoexcept
, so I changed the superfluous conditionalnoexcept
to unconditional one.vector<bool, _Alloc>
from(vector&&, const _Identity_t<_Alloc>&)
is notnoexcept
in the current working draft, so I added// strengthened
.vector<bool, _Alloc>
detect the properties of_Alvbase
, which is consistent with other containers that need allocator rebinding.vector<bool>
missing exception specifications #3226 (comment)), which would be able to resolve the divergence between standard requirements and actual implementations._Vb_val
is not even move-assignable - the explicitly declared move constructor make the move assignment operator not declared, and the copy assignment operator implicitly deleted.