-
-
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
compiling with gcc 7 -> error on bool operator < #590
Comments
Could you provide more information: what do you compile? Are there more error messages with other file locations? |
https://github.com/buffos/carnd_projects/tree/master/10.project.mpc It has few dependencies though. |
here is the full output of the compilation
|
Could you paste the complete error message? I compiled the test suite of this library with GCC7 without problems. |
I just did above :) |
It seems that the compiler tries to parse To rule out a problem with your compiler: can you try to compile the unit tests for nlohmann/json (by just calling cmake/make after cloning nlohmann/json? |
I tried |
So GCC6 works with your code, but GCC7 does not? This is strange. Then again, can you reproduce the error which fewer dependencies? |
I will. |
I met the same problem, here's one way to produce it: a.cc: #include <string>
using namespace std;
#include "json.hpp" Compiling it with |
I cannot reproduce this issue with
I can compile and run the complete test suite from the @whenov What is the OS/version of your compiler, and can you provide the error message? |
I'm having the exact same issue when compiling any OpenFrameworks app on Arch Linux since updating gcc to 7.1.1
|
I tried to help @alberto2000 track this down in IRC earlier. In https://github.com/openframeworks/openFrameworks/blob/master/libs/openFrameworks/utils/ofConstants.h#L435 -- 'using namespace std;' is present and indirectly ahead of the include for json.hpp, which seems to trigger the issue. @buffos -- your code also has a 'using namespace std;' indirectly before json.hpp is included @nlohmann -- I did the same as @whenov and had the same error message about template arguments, which goes away if 'using namespace std;' is commented out. The test suite built and ran fine. |
@nlohmann
|
Ok, now I can also reproduce the error with the following code and GCC-7: using namespace std;
#include <json.hpp>
int main()
{} The error is
It is very strange that the name |
Changing the line in
seems to fix the error using that simple test case. It's quite possible this is a GCC bug; I can't understand why |
Yes, definitely seems like a compiler bug, especially if it worked fine in other GCC7 versions, then it's probably a regression. |
@jebrosen Thanks for the fix. I shall implement it. I further try to get a GCC7 working in Travis so such errors can be detected automatically. As for the bug - it would be great to boil the problem down to a size that is "digestible" by StackOverflow. Any help would be greatly appreciated. |
I opened an issue on StackOverflow, see https://stackoverflow.com/questions/44367859/using-stdarray-and-using-array-as-name It is not sure yet whether this is an issue in the language or the compilers. Nevertheless, adding parentheses fixes the problem, so I close this issue. |
Due to error: nlohmann/json#590
This issue seems to have come back with the 3.6.0 release. I guess this was caused by some automatic reformatting: Here's the line that previously had parenthesis https://github.com/nlohmann/json/blob/release/3.6.0/include/nlohmann/json.hpp#L5731 Also this problem still appears with GCC 8.2.1 |
Oh, that's a pity! I use GCC 7 and 8 in the CI, but did not catch this issue. Is it just the array comparison? |
@nlohmann I haven't tested the commit you linked but adding the parenthesis by hand locally fixes it for me. |
* Add batch set/delete() to ProducerStateTable * Add StatusCode enum and functions to convert between string and enum values. * Allow exists() to check for whitespace. This is only to allow whitespace when we check for existence. We can already create entries with whitespace. * Add SWSS return code SWSS_RC_UNIMPLEMENTED * Fix json error, refer to nlohmann/json#590 Submission containing materials of a third party: Copyright Google LLC; Licensed under Apache 2.0 Co-authored-by: Akarsh Gupta <[email protected]> Co-authored-by: Jay Hu <[email protected]> Co-authored-by: Manali Kumar <[email protected]> Co-authored-by: Robert J. Halstead <[email protected]> Co-authored-by: Runming Wu <[email protected]> Co-authored-by: Yilan Ji <[email protected]> Signed-off-by: Don Newton [email protected]
* Add batch set/delete() to ProducerStateTable * Add StatusCode enum and functions to convert between string and enum values. * Allow exists() to check for whitespace. This is only to allow whitespace when we check for existence. We can already create entries with whitespace. * Add SWSS return code SWSS_RC_UNIMPLEMENTED * Fix json error, refer to nlohmann/json#590 Submission containing materials of a third party: Copyright Google LLC; Licensed under Apache 2.0 Co-authored-by: Akarsh Gupta <[email protected]> Co-authored-by: Jay Hu <[email protected]> Co-authored-by: Manali Kumar <[email protected]> Co-authored-by: Robert J. Halstead <[email protected]> Co-authored-by: Runming Wu <[email protected]> Co-authored-by: Yilan Ji <[email protected]> Signed-off-by: Don Newton [email protected]
* Add batch set/delete() to ProducerStateTable * Add StatusCode enum and functions to convert between string and enum values. * Allow exists() to check for whitespace. This is only to allow whitespace when we check for existence. We can already create entries with whitespace. * Add SWSS return code SWSS_RC_UNIMPLEMENTED * Fix json error, refer to nlohmann/json#590 Submission containing materials of a third party: Copyright Google LLC; Licensed under Apache 2.0 Co-authored-by: Akarsh Gupta <[email protected]> Co-authored-by: Jay Hu <[email protected]> Co-authored-by: Manali Kumar <[email protected]> Co-authored-by: Robert J. Halstead <[email protected]> Co-authored-by: Runming Wu <[email protected]> Co-authored-by: Yilan Ji <[email protected]> Signed-off-by: Don Newton [email protected]
* Add batch set/delete() to ProducerStateTable * Add StatusCode enum and functions to convert between string and enum values. * Allow exists() to check for whitespace. This is only to allow whitespace when we check for existence. We can already create entries with whitespace. * Add SWSS return code SWSS_RC_UNIMPLEMENTED * Fix json error, refer to nlohmann/json#590 Submission containing materials of a third party: Copyright Google LLC; Licensed under Apache 2.0 Co-authored-by: Akarsh Gupta <[email protected]> Co-authored-by: Jay Hu <[email protected]> Co-authored-by: Manali Kumar <[email protected]> Co-authored-by: Robert J. Halstead <[email protected]> Co-authored-by: Runming Wu <[email protected]> Co-authored-by: Yilan Ji <[email protected]> Signed-off-by: Don Newton [email protected]
* Add batch set/delete() to ProducerStateTable * Add StatusCode enum and functions to convert between string and enum values. * Allow exists() to check for whitespace. This is only to allow whitespace when we check for existence. We can already create entries with whitespace. * Add SWSS return code SWSS_RC_UNIMPLEMENTED * Fix json error, refer to nlohmann/json#590 Submission containing materials of a third party: Copyright Google LLC; Licensed under Apache 2.0 Co-authored-by: Akarsh Gupta <[email protected]> Co-authored-by: Jay Hu <[email protected]> Co-authored-by: Manali Kumar <[email protected]> Co-authored-by: Robert J. Halstead <[email protected]> Co-authored-by: Runming Wu <[email protected]> Co-authored-by: Yilan Ji <[email protected]> Signed-off-by: Don Newton [email protected]
* Add batch set/delete() to ProducerStateTable * Add StatusCode enum and functions to convert between string and enum values. * Allow exists() to check for whitespace. This is only to allow whitespace when we check for existence. We can already create entries with whitespace. * Add SWSS return code SWSS_RC_UNIMPLEMENTED * Fix json error, refer to nlohmann/json#590 Submission containing materials of a third party: Copyright Google LLC; Licensed under Apache 2.0 Co-authored-by: Akarsh Gupta <[email protected]> Co-authored-by: Jay Hu <[email protected]> Co-authored-by: Manali Kumar <[email protected]> Co-authored-by: Robert J. Halstead <[email protected]> Co-authored-by: Runming Wu <[email protected]> Co-authored-by: Yilan Ji <[email protected]> Signed-off-by: Don Newton [email protected]
* Add batch set/delete() to ProducerStateTable * Add StatusCode enum and functions to convert between string and enum values. * Allow exists() to check for whitespace. This is only to allow whitespace when we check for existence. We can already create entries with whitespace. * Add SWSS return code SWSS_RC_UNIMPLEMENTED * Fix json error, refer to nlohmann/json#590 Submission containing materials of a third party: Copyright Google LLC; Licensed under Apache 2.0 Co-authored-by: Akarsh Gupta <[email protected]> Co-authored-by: Jay Hu <[email protected]> Co-authored-by: Manali Kumar <[email protected]> Co-authored-by: Robert J. Halstead <[email protected]> Co-authored-by: Runming Wu <[email protected]> Co-authored-by: Yilan Ji <[email protected]> Signed-off-by: Don Newton [email protected]
* Add batch set/delete() to ProducerStateTable * Add StatusCode enum and functions to convert between string and enum values. * Allow exists() to check for whitespace. This is only to allow whitespace when we check for existence. We can already create entries with whitespace. * Add SWSS return code SWSS_RC_UNIMPLEMENTED * Fix json error, refer to nlohmann/json#590 Submission containing materials of a third party: Copyright Google LLC; Licensed under Apache 2.0 Co-authored-by: Akarsh Gupta <[email protected]> Co-authored-by: Jay Hu <[email protected]> Co-authored-by: Manali Kumar <[email protected]> Co-authored-by: Robert J. Halstead <[email protected]> Co-authored-by: Runming Wu <[email protected]> Co-authored-by: Yilan Ji <[email protected]> Signed-off-by: Don Newton [email protected]
when compiling i get
json.hpp:6395:66: error: wrong number of template arguments (1, should be 2) return *lhs.m_value.array < *rhs.m_value.array;
and
/usr/include/c++/7/array:94:12: note: provided for ‘template<class _Tp, long unsigned int _Nm> struct std::array’ struct array
The text was updated successfully, but these errors were encountered: