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

msvc 17.3.4 c++20 consteval error with master and tag 9.1.0 #3107

Closed
ridilculous opened this issue Sep 20, 2022 · 3 comments
Closed

msvc 17.3.4 c++20 consteval error with master and tag 9.1.0 #3107

ridilculous opened this issue Sep 20, 2022 · 3 comments
Labels

Comments

@ridilculous
Copy link

ridilculous commented Sep 20, 2022

With msvc 17.3.4 i'm getting compilation errors with 9.1.0 and master (for char and wchar_t) but not with 9.0.0:

error C7595: 'fmt::v9::basic_format_string<char,std::string &>::basic_format_string': call to immediate function is not a constant expression
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2272,35): message : failure was caused by a read of a variable outside its lifetime
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2272,35): message : see usage of 'f'
error C7595: 'fmt::v9::basic_format_string<wchar_t,std::wstring &>::basic_format_string': call to immediate function is not a constant expression
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2272,35): message : failure was caused by a read of a variable outside its lifetime
1>C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\xstring(2272,35): message : see usage of 'f'

godbolt string test

godbolt wstring test

This is maybe related to #2455

@vitaut
Copy link
Contributor

vitaut commented Sep 20, 2022

Format strings must be known at compile time by default, please see the docs: https://fmt.dev/latest/api.html#core-api.

@ridilculous
Copy link
Author

Oh, thanks! I wasn't aware of runtime format strings.

Is there a implicit ctor which makes the wstring version work in contrast to the string version? (example)

@vitaut
Copy link
Contributor

vitaut commented Sep 20, 2022

Compile-time checks for wide strings were only enabled recently. I guess the version on godbolt doesn't have them yet.

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

No branches or pull requests

2 participants