You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When exporting C++20 module with imported nlohmann::json as header unit and std module, a lot of redefinition errors occurs. This is not visible when importing iostream as header unit instead of std module.
Reproduction steps
Create primary interface module and import std module and nlohmann::json as header unit
Expected vs. actual results
It is expected to compile code without any error. As actual result, compilation fails.
This issue has been marked as stale because it has been open for 90 days without activity. If this issue is still relevant, please add a comment or remove the "stale" label. Otherwise, it will be closed in 10 days. Thank you for helping us prioritize our work!
github-actionsbot
added
the
state: stale
the issue has not been updated in a while and will be closed automatically soon unless it is updated
label
Feb 13, 2025
This happens when somewhere along the chain there is a direct or transitive #include of STL headers after there was an import std statement. It seems like the include guards don't get imported with import std, which is expected behavior, as pre-processor definitions should not leak outwards from modules, but for some weird reason, all the actual symbol definitions do leak outwards from import std, which is not expected behavior and leads to the ODR violations that we see in the output.
This not only applies to import std, but any imported module, which includes STL headers in its global module fragment.
It's a nasty bug, because it prevents the migration of large codebases, where you will inevitably run into mixed situations of STL header includes and imports.
github-actionsbot
removed
the
state: stale
the issue has not been updated in a while and will be closed automatically soon unless it is updated
label
Feb 16, 2025
Description
When exporting C++20 module with imported nlohmann::json as header unit and std module, a lot of redefinition errors occurs. This is not visible when importing iostream as header unit instead of std module.
Reproduction steps
Create primary interface module and import std module and nlohmann::json as header unit
Expected vs. actual results
It is expected to compile code without any error. As actual result, compilation fails.
Minimal code example
Error messages
Compiler and operating system
Visual Studio 2022 17.6.2
Library version
3.11.2
Validation
develop
branch is used.The text was updated successfully, but these errors were encountered: