Skip to content

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

Merged
Stephan T. Lavavej (StephanTLavavej) merged 1 commit into
microsoft:mainfrom
StephanTLavavej:an-unexpected-journey
May 9, 2022
Merged

Block C++98 unexpected() from being restored in C++23 mode#2709
Stephan T. Lavavej (StephanTLavavej) merged 1 commit into
microsoft:mainfrom
StephanTLavavej:an-unexpected-journey

Conversation

@StephanTLavavej

Copy link
Copy Markdown
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.

Comment thread stl/inc/yvals_core.h
Comment thread stl/inc/yvals_core.h
@StephanTLavavej

Copy link
Copy Markdown
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.

Igor Zhukov (fsb4000) added a commit to fsb4000/STL that referenced this pull request May 7, 2022
@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) merged commit 488e789 into microsoft:main May 9, 2022
@StephanTLavavej
Stephan T. Lavavej (StephanTLavavej) deleted the an-unexpected-journey branch May 9, 2022 23:57
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