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

Block C++98 unexpected() from being restored in C++23 mode #2709

Merged

Conversation

StephanTLavavej
Copy link
Member

C++98's unexpected() was removed by C++17, then C++23 reused the identifier for <expected>'s unexpected<E> (being implemented in #2643).

We support escape hatches for restoring Standard-removed machinery, but we need to avoid this conflict. Instead of limiting what C++23 provides, we should simply disable this escape hatch when it conflicts with the Standard. (Note that C++98 unexpected() and its related functions weren't very useful, and MSVC never properly implemented them, thus this is mostly relevant for library test suites. It's a very different situation than auto_ptr, for example.)

This PR will be paired with internal changes to VCRuntime, as its <eh.h> defines unexpected() et al. in the global scope, and we need to prevent that conflict too. We can complete this PR independently of #2643.

@StephanTLavavej StephanTLavavej added the enhancement Something can be improved label May 6, 2022
@StephanTLavavej StephanTLavavej requested a review from a team as a code owner May 6, 2022 19:51
stl/inc/yvals_core.h Show resolved Hide resolved
stl/inc/yvals_core.h Show resolved Hide resolved
@StephanTLavavej StephanTLavavej self-assigned this May 6, 2022
@StephanTLavavej
Copy link
Member Author

Mirrored as internal MSVC-PR-397684. This has associated VCRuntime changes and a higher-than-normal chance of encountering issues in old test suites (although my local test run passed), hence the mirror all by itself.

fsb4000 added a commit to fsb4000/STL that referenced this pull request May 7, 2022
@StephanTLavavej StephanTLavavej merged commit 488e789 into microsoft:main May 9, 2022
@StephanTLavavej StephanTLavavej deleted the an-unexpected-journey branch May 9, 2022 23:57
fsb4000 pushed a commit to fsb4000/STL that referenced this pull request Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Something can be improved
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
  翻译: