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

type_info is not exported correctly #4643

Closed
huangqinjin opened this issue Apr 30, 2024 · 3 comments
Closed

type_info is not exported correctly #4643

huangqinjin opened this issue Apr 30, 2024 · 3 comments
Labels
bug Something isn't working fixed Something works now, yay! modules C++23 modules, C++20 header units

Comments

@huangqinjin
Copy link

Run preprocessor on std.ixx and inspect its output:

>cl /EHsc /std:c++latest /P "%VCToolsInstallDir%\modules\std.ixx"
Microsoft (R) C/C++ Optimizing Compiler Version 19.40.33808 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

/std:c++latest is provided as a preview of language features from the latest C++
working draft, and we're eager to hear about bugs and suggestions for improvements.
However, note that these features are provided as-is without support, and subject
to changes or removal as the working draft evolves. See
https://go.microsoft.com/fwlink/?linkid=2045807 for details.

std.ixx

Search type_info in std.i from top, we see that the first statement is in eh.h

extern "C++" { // attach declarations to the global module, see N4910 [module.unit]/7
    class type_info;
} // extern "C++"

and later in vcruntime_typeinfo.h it is exported:

extern "C++" { 
export class type_info {};
}

I believe this violates https://eel.is/c++draft/module.interface#6

A redeclaration of an entity X is implicitly exported if X was introduced by an exported declaration; otherwise it shall not be exported.

@StephanTLavavej StephanTLavavej added bug Something isn't working modules C++23 modules, C++20 header units labels May 1, 2024
@StephanTLavavej
Copy link
Member

Thanks - I forgot to search VCRuntime for forward-declaring its own machinery. (This would be easier if MSVC enforced the Standard rule; I've got an active bug requesting that from the compiler team.)

@StephanTLavavej
Copy link
Member

Created internal MSVC-PR-549242.

@StephanTLavavej StephanTLavavej added the fixed Something works now, yay! label May 7, 2024
@StephanTLavavej
Copy link
Member

Fix merged for VS 2022 17.11 Preview 3. Thanks again for the report! 😻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed Something works now, yay! modules C++23 modules, C++20 header units
Projects
None yet
Development

No branches or pull requests

2 participants