-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Enhance _STL_VERIFY
for std::barrier
#3757
Conversation
@@ -93,9 +93,8 @@ public: | |||
} | |||
|
|||
_NODISCARD_BARRIER_TOKEN arrival_token arrive(ptrdiff_t _Update = 1) noexcept /* strengthened */ { | |||
// Shifting before precondition check, so that exceeding max() will trigger precondition check too | |||
_STL_VERIFY(_Update > 0 && _Update <= (max) (), "Precondition: update > 0 (N4950 [thread.barrier.class]/12)"); |
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.
Sorry for this late review -- I didn't realize it was "Pending"-ed.
_Update <= max()
is necessary, as it avoids large positive value becoming negative after shift. However, this will cause a mismatch between the check and error message. This check is more relevant to the constraint "update <= expected count"
, but I don't think we should put it off. I have no idea how to make an improvement. Any ideas?
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.
I'm okay with a slightly confusing message here.
I'm speculatively mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
Thanks for enhancing the Great Galactic Barrier that keeps the Alpha Quadrant safe! 🛡️ 🛸 😹 |
Fixes #3748.