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

<any>: std::any links when exceptions are disabled #2193

Merged
merged 9 commits into from
Jun 2, 2022

Conversation

fsb4000
Copy link
Contributor

@fsb4000 fsb4000 commented Sep 8, 2021

Fixes #990

@fsb4000 fsb4000 requested a review from a team as a code owner September 8, 2021 14:02
@StephanTLavavej StephanTLavavej added the bug Something isn't working label Sep 8, 2021
@StephanTLavavej
Copy link
Member

After looking at this, I agree that the change is correct and ABI-safe.

Usually, anything mentioning _CRTIMP2_IMPORT affects ABI. However, your analysis is correct - these are guarded by #if !_HAS_EXCEPTIONS and we never build the STL's DLL in that mode (with the exception of stl/src/raisehan.cpp but that doesn't drag in <typeinfo>), so they never expand to __declspec(dllexport). Thus the macros should be removed, so that they never expand to __declspec(dllimport) for user code.

I have verified this by inspecting the DLL's exports (these types don't appear), and by performing an internal build of the STL with

#if !_HAS_EXCEPTIONS

#if defined(CRTDLL2) && defined(_CRTBLD)
#error WOOF
#endif

// ...

here; it succeeded, proving that these are indeed never exported.

@StephanTLavavej StephanTLavavej self-assigned this Jun 1, 2022
@StephanTLavavej
Copy link
Member

I'm (speculatively) mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 79bf997 into microsoft:main Jun 2, 2022
@StephanTLavavej
Copy link
Member

Thanks for fixing this long-standing bug! 😻 🐞 🎉

@fsb4000 fsb4000 deleted the fix990 branch June 2, 2022 04:10
fsb4000 added 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
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<any>: std::any doesn't link when exceptions are disabled
3 participants