-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
2.1.1+ breaks compilation of shared_ptr<json> == 0 #610
Comments
Fixes incorrect parsing of numbers with decimal point in locales that use a decimal period natively. The latest version cannot be used, because it breaks compilation with Boost.Thread, see nlohmann/json#610
I have no idea how to fix this from my side. |
Me neither, trivially, otherwise I would have submitted a PR instead. Generally speaking, the over-eager implicit conversions (it was the recent custom types support that caused this) is causing the trouble, so more explicitness in that are would likely help. I think this issue is a useful canary in a way: it's not entirely unlikely to cause similar issues elsewhere. If it were Boost.Thread only, well, that's only a matter of time until Boost-side fix bubbles up into a release and Linux distros. |
I think there is nothing I can do about this. Good to have this issue if someone has the same problem. |
This is forced by incompatiblity between JSON for Modern C++ and Boost.Threads up to 1.64, as used by Poedit's code. See nlohmann/json#610
This is forced by incompatiblity between JSON for Modern C++ and Boost.Threads up to 1.64, as used by Poedit's code. See nlohmann/json#610
v2.1.1 introduced regression that breaks compilation of existing code that compiled with up to v2.1.0. The breakage was introduced in #415 (fixing #414) and relates to over-reaching template
operator==
.Code that uses
std::shared_ptr<json>
and compares it with zero (both== 0
and!= 0
) no longer compiles due to operator ambiguity that is not immediately (or even no so immediately...) apparent to a mere human like me, but nevertheless I confirmed was caused by #415.This is enough to reproduce:
This doesn't make the compiler happy:
Yes, it would be better to compare with
nullptr
or use implicit conversion to bool, and it would be trivial to fix the above example, but you don't always have a choice… such as when using another library where this happens internally to it. To name a prominent example, Boost.Thread is affected:results in
Observed with both clang-802.0.42 and Visual Studio 2015, so this isn't compiler-specific.
The text was updated successfully, but these errors were encountered: