Skip to content

avoid include locale inline if c++20 modules are enabled #4451

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

Merged
merged 1 commit into from
May 22, 2025

Conversation

arBmind
Copy link
Contributor

@arBmind arBmind commented May 18, 2025

MSVC hints with:

fmt\include\fmt\format-inl.h(26): warning C5244: '#include <locale>' in the purview of module 'fmt' appears erroneous.  Consider moving that directive before the module declaration, or replace the textual inclusion with 'import <locale>;'.

Then fails the build with type redefinition.

See https://github.com/arBmind/fmtlib-module-experiment for a full example.

Copy link
Contributor

@vitaut vitaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include the error in the PR summary and revert unrelated formatting changes.

@arBmind arBmind force-pushed the feature/import-std-locale branch 2 times, most recently from b8afbf9 to 4057ea8 Compare May 20, 2025 19:48
@arBmind arBmind requested a review from vitaut May 20, 2025 19:50
Comment on lines 25 to 27
#if FMT_USE_LOCALE
# include <locale>
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the correct fix is to keep the include here but change the ifdef to

#if !defined(FMT_MODULE) && FMT_USE_LOCALE

MSVC hints with:
```
fmt\include\fmt\format-inl.h(26): warning C5244: '#include <locale>' in the purview of module 'fmt' appears erroneous.  Consider moving that directive before the module declaration, or replace the textual inclusion with 'import <locale>;'.
```

Then fails the build with `type redefinition`.
@arBmind arBmind force-pushed the feature/import-std-locale branch from 4057ea8 to 082da8f Compare May 21, 2025 22:12
@arBmind arBmind requested a review from vitaut May 21, 2025 22:12
@vitaut vitaut merged commit f7033da into fmtlib:master May 22, 2025
45 checks passed
@vitaut
Copy link
Contributor

vitaut commented May 22, 2025

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants