-
-
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
error when using nlohmann::json, std::function and std::bind #2147
Comments
Can you please try to compile the test suite? As the used compiler (GCC 4.8.5) is quite old, this may be a bug in its C++11 implementation. |
I tried to cross build unit test and it is ok. @nlohmann |
I used jsonformoderncpp/3.4.0@vthiery/stable before. This version is ok for gcc 4.8.5. However, this vesion is not maintained by conan official. nlohmann_json jsonformoderncpp |
This is caused by json's see #958 for discussion on the topic. edit I managed to isolate the specific part of the bind process that's failing: This produces the same error:
|
In the end, this boils down to the following question: Should the following be able to compile?
https://gcc.godbolt.org/z/6vwHuM I'd say that the answer is evidently yes. And it's pretty obvious to me that it's GCC 4.8.5 that's broken here. Now the only remaining question is: Is it worthwhile to work around this compiler bug or not? I tried sprinkling a few My take would be: if we get rid of the allegedly evil |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Maybe related: #2226 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
the json lib version 3.10 still has this isue: |
If someone cares enough to run a |
error: |
Can you run https://git-scm.com/docs/git-bisect on this code? |
What is the issue you have?
g++ 4.8.5 and nlohmann/3.7.3, error: value-initialization of reference type 'const nlohmann::basic_json<>&' when compiler example
Please describe the steps to reproduce the issue.
Can you provide a small but working code example?
here is the simplest example online:
godbolt
What is the expected behavior?
compile pass
And what is the actual behavior instead?
compiler error
Which compiler and operating system are you using?
Which version of the library did you use?
develop
branchIf you experience a compilation error: can you compile and run the unit tests?
The text was updated successfully, but these errors were encountered: