-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
Json and fmt::lib's format_arg() #964
Comments
After hacking the library a bit with Alex we found that removing the Luckily we can workaround the problem as Alex said with the internal fmt macro, while waiting for the next major json version (if we decide to remove |
I'm not convinced that removing |
Can this be closed as the error can be fixed by defining a macro in fmtlib? |
I can not call that a fix, since you have to used an undocumented API from fmtlib. The real bug is that json somehow short circuit the fmt's static_assert. replacing the cute and informative message about customization point by compiler errors barf. I was lucky to find the workaround with the fmtlib. But I suspect someone would come across the same issue with different lib and not be so "fortunate". |
If the only fix is #958, then this issue will not be fixed for a while (if ever). :-( |
Closing this for now. |
@AlexandreBossard what was this glorious macro that disabled the implicit int conversion?!? is it still in fmt? I dont see it. |
Bug Report
jsonbug.zip
I use the glorious fmt::lib for my project. Since i got bored of typing code
like
fmt::print("my json {}", jsonvar.dump(2));
, i set myself to use the fmt customization point for user-defined type.Normally, fmtlib trigger static_assert when unrecognized type are passed as arguments, asking you to defined
format_arg()
or anostream<<
overload.Not with nhlomann::json. I get some horrible error messages with gcc (7.2.0) with an ambiguous call to a constructor of some fmtlib internals.
By digging fmt code, i found a macro which disabled implicit int conversion. Shooting in the dark, copy paste the macro, and passing nhlomann::json to it. Fixed!
I am not sure if this is a the fmtlib or json fault (both?). But looking for related issues in both project, i found this one #958, which kind of help me.
The text was updated successfully, but these errors were encountered: