-
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
gcc 11, C++20: error: 'f' is not a constant expression #2753
Comments
The format string must be known at compile time or wrapped in |
I also encounter this problem with
I thought #include <iostream>
#include "fmt/format.h"
template<typename... Args>
void foo(std::string_view f, Args... args){
const auto bar = fmt::format(f, args...);
std::cout << bar << std::endl;
}
int main() {
foo("test {} {}", 1, 2);
} Update: I am forcing runtime for the time being, until this issue is resolved. #2438 |
It is not. |
Update: Turns out if I am willing to give up @vitaut Sorry for posting new messages to the "closed" issue. |
No worries, glad you've found the solution. |
Under Linux with gcc 11 the following example builds fine with -std=c++17 but fails to build with -std=c++20:
libfmt 8.0.1 and 8.1.1:
Why?
The text was updated successfully, but these errors were encountered: