Open tobias-loew opened 2 weeks ago
You aren't obligated to use the submodule version of fmt
. You can install whatever version you like and use it as a system dependency. That said, I don't think we've ever tested compiling Cantera with the compiler set to use the C++20 standard, so there may be other issues there.
After further investigation, the issue is not with fmt
version 9.1.0. Rather, the issue is with some compile-time checks that are enabled by fmt
when compiling in C++20 mode that require changes to the Cantera source. The fmt documentation provides a bit of info. The gist of it is that in cases where the format string isn't a compile-time constant, it needs to be wrapped in fmt::runtime
.
I've started a branch with these changes here. It needs some work to ensure that we're actually backwards compatible as far we want to be, and to test this as part of the CI.
One somewhat odd behavior I found was that I didn't get any errors compiling with C++20 mode using Apple Clang on macOS, even without these changes.
just as a note: this problem occurs when trying to compile one of the examples. so C++ Cantera users are currently forced to use C++17 or earlier.
Compiling the C++ API with C++20 or newer results in errors with calls to the fmt library. E.g. with msvc 143, c++latest:
1>D:\loew\proj\cantera\include\cantera\base\ctexceptions.h(89,32): error C7595: 'fmt::v9::basic_format_string::basic_format_string': call to immediate function is not a constant expression
1>D:\loew\proj\cantera\include\cantera\base\AnyMap.h(749,64): error C7595: 'fmt::v9::basic_format_string<char,const std::string &,const std::string &>::basic_format_string': call to immediate function is not a constant expression
1>D:\loew\proj\cantera\include\cantera\base\ctexceptions.h(89,32): error C7595: 'fmt::v9::basic_format_string<char,const double &>::basic_format_string': call to immediate function is not a constant expression
1>D:\loew\proj\cantera\include\cantera\base\ctexceptions.h(89,32): error C7595: 'fmt::v9::basic_format_string<char,const std::string &,const std::string &,const std::string &>::basic_format_string': call to immediate function is not a constant expression
1>D:\loew\proj\cantera\include\cantera\base\global.h(231,46): error C7595: 'fmt::v9::basic_format_string::basic_format_string': call to immediate function is not a constant expression
The version of the fmt submodule is outdated and should be updated to a recent version.
Try to compile the simple-demo with C++20 or newer on msvc
Behavior
compilation errors
System information
Attachments
Additional context