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

FMT_STRING issue w/ clang, spdlog 1.15.1 and external fmt 11.1.3 #3333

Open
abrownsword opened this issue Feb 1, 2025 · 5 comments
Open

Comments

@abrownsword
Copy link

In straightforward spdlog-using code (that was changed a couple of years back to use FMT_STRING everywhere), after updating to spdlog 1.15.1 and an external fmt 11.1.3, I'm seeing this across the entire codebase. Building with Clang 19.1.6 set to C++20 using gnu stdlibc++ on Ubuntu 24.04:

error: implicit instantiation of undefined template 'fmt::detail::type_is_unformattable_for<FMT_COMPILE_STRING, char>'
     |     type_is_unformattable_for<T, char_type> _;

The line of code is (but this occurs identically on several hundred logging calls):

logger->debug(FMT_STRING("my string"));

I have seen various reported issues in fmt & spdlog repos saying this was fixed via issue fmtlib/fmt#4177 ... however I am on the latest code and am still seeing this issue. Removing FMT_STRING at any given callsite eliminates the error, but I'm not excited about making such a sweeping change across the codebase (and it would make reverting much harder). The macro still seems to be supported, however it appears to be broken.

@gabime
Copy link
Owner

gabime commented Feb 1, 2025

What would be the fix ?

@abrownsword
Copy link
Author

I don't know, but a couple of direct uses of fmt::format(FMT_STRING("..."), ...) in the same file as the above error compile fine.

@gabime
Copy link
Owner

gabime commented Feb 1, 2025

It works as long as there are params. Not related to direct uses.
Fwiw “replace all” works pretty well with any IDE :)

@abrownsword
Copy link
Author

Ah yes, I hadn't noticed that the failure cases were all without args. Perhaps an additional overload of info/debug/warn/etc is required then?

As I mentioned above making a sweeping change increases the difficulty of reverting to an older version if some other issue is discovered.

@gabime
Copy link
Owner

gabime commented Feb 1, 2025

So perhaps redefine the macro after including spdlog.h or replace all code with custom macro name that does nothing, so it would be easy to revert

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

No branches or pull requests

2 participants