-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
MSVC errors when importing both fmt and std modules #3921
Comments
tl;dr I created a new fork with all changes (in reverse chronological order) required to use (i.e. not just build a static lib) MSVC + C++ modules + fmt:
|
Use |
Note that |
A PR for the conditional expression is constant warning is welcome (using
What is the problem that you are trying to solve with this change?
I would wait until the |
Done
This is not something that is apparent when fmt is built as a static library and be done with it. Upon using this version my own wrappers (in particular the |
AFAICS |
My mistake. |
Imho, given the potential reduced build time Though, the below specific snippet is a hack for sure and not something I suggest using ;-) #define static
#include <time.h>
#undef static |
We maintain an internal fork of The error " I also can't reproduce the error with |
Good catch. This fixes both
Fwiiw in my case, the error is logged upon building module implementation units that use |
Fair enough. Could you submit a PR to do this (possibly in a subset of {fmt} for starters)? |
|
With #3928 merged, I guess this can be closed now. The fileno warning is unrelated to modules but a PR to fix it would be welcome. |
|
I now also modularized some Windows specific code requiring import fmt;
auto main()
-> int
{
auto str = fmt::format(L"{}", 1u);
return 0;
}
@ShifftC do you happen to have a specific workaround (or do you only use My experience so far with all the internal compiler errors for C++ modules that I encountered, is that there are workarounds. Unfortunately, it requires stripping every use case down to a few LOCs in order to isolate the actual problem. |
If have a fork with some fixes for msvc and clang, including an ice, still trying to get it to work with gcc but that might just be my setup. Not sure if it's the same ice, currently not home so I can't test it. |
Tried it for the above example. Unfortunately, still the same ice. Created a ticket. |
Compiling the example before #3928 gives I have also done some testing because of the error with |
Upon some further trial and error, it turns out that
|
MSVC has an open bug that prevents a.o. importing both fmt and std modules in some use cases (i.e. depends which functionality one uses from the std) due to the mixing of std includes inside fmt itself and using
import std
.For example:
It is possible to work around this by replacing std includes inside fmt with
import std
instead, and including the C headers for the few types and functions defined outside thestd
namespace (because these are not exported from thestd
module):Maybe something worth considering with an optional feature macro?
The text was updated successfully, but these errors were encountered: