Fix error_category regression with Boost.System#3176
Merged
StephanTLavavej merged 2 commits intomicrosoft:mainfrom Oct 26, 2022
Merged
Fix error_category regression with Boost.System#3176StephanTLavavej merged 2 commits intomicrosoft:mainfrom
error_category regression with Boost.System#3176StephanTLavavej merged 2 commits intomicrosoft:mainfrom
Conversation
CaseyCarter
suggested changes
Oct 25, 2022
strega-nil-ms
approved these changes
Oct 25, 2022
Contributor
strega-nil-ms
left a comment
There was a problem hiding this comment.
reluctantly approved 😿
CaseyCarter
approved these changes
Oct 25, 2022
Member
Author
|
I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed. |
frederick-vs-ja
approved these changes
Oct 26, 2022
|
@StephanTLavavej Thank you very much for this fix |
|
Should have alerted me about it. :-) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Followup to #3139.
Bad kitties jump up on the table where they're not allowed. 😼 Boost.System was a very bad kitty:
https://github.com/boostorg/system/blob/9a6d79b84147854aa919644b56b8553f5a2bedb8/include/boost/system/detail/std_category.hpp#L46-L52
When #3139 fixed
error_category's default constructor to beconstexpr, it had to change_Addrinto aunion, breaking this highly non-Standard code in Boost.System. This resulted in widespread breakage in our test team's "Real World Code" suites.Because Boost is a widely used third-party library, even if we reported this upstream and they were somehow able to avoid doing this, or simply changed their non-Standard code to detect our new
error_categoryand use different non-Standard code, projects throughout the C++ ecosystem would be broken until they updated Boost.Adjusting the STL's code to continue permitting this non-Standard usage is the least undesirable option here (compared to reverting #3139, refusing to yield, adding an escape hatch, etc.). Notes for these changes:
publicoperator=to_Addr_storage, but it and_Addrare stillprotected, so this is not observable to Standard code.constexprto be "transparent", even though Boost doesn't need this.uintptr_talso to be transparent, because that's what we store.noexceptto avoid emitting EH enforcement.While RWC test coverage would be sufficient, I'm adding a bit of test code in order to more quickly detect any maintenance changes that would break this workaround. The test takes
unsigned intbecause that's what Boost is using.(To be clear, I love Boost and I've used it for 20 years, but accessing internal data members is problematic for precisely this reason! 😹)