-
-
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
Digraph warning #679
Digraph warning #679
Conversation
The original version can trigger a digraph-related warning in VS2015. Is this namespace construct a typo or something deliberate?
I would prefer to insert a space here, but if astyle removes it, I don't see how this could cause any issues. Except if one day there is a |
This token sequence is explicitly called out by the standard as not a digraph. What is the exact warning that you're getting?
|
The project in question is a Visual Studio project, maintained by the proprietary UnrealEngine4 project/build system. This system seemingly turns on the VS2015 non-default
So, this seems to be a VS C++11 incompatibility. This is classified as a non-issue during setting up the pull request. Slightly annoying, but eventually I have to accept this.. |
It also seems to turn on the C4628 warning, as it's off by default. I found that Qt dealt with this same compiler bug by adding a space after the <. If you can find a way to disable the C4628 warning, this should also take care of your issue. |
@nlohmann Two of the Travis builds failed because the compiler couldn't find the |
Personally, I consider this fragile (bringing back to mind the good old days of ambiguous '<<') for similar reasons as mentioned by @theodelrieu. I have still to look-up the particular name-resolution rules - but perhaps the leading scope operator isn't necessary here? For the specialization immediately above ( |
@gregmarr I also noticed this, and I have no idea why Travis behaves this way. I think I need to remove these configurations. |
I'm not sure what is more fragile, adding a space to eliminate a bogus compiler warning, or making the type specification less specific by removing the global specifier and allowing lookup in the local scope, with any using declarations that have been added. The latter can result in users not getting the behavior they expect. The former can result in the warning coming back if the space gets removed. Since the compiler warning can be silenced, or the compiler bug fixed, I'd lean towards adding the space. Note that I'm just a user, not a maintainer, so I don't make that decision, just provide input. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the ::
is not a good idea. Adding a space would be OK - astyle
does not revert this change. Please make a comment regarding the necessity of the space with a link to this PR.
It seems, I am not quite familiar with some aspects of the github workflow. What do you mean here - a line comment on the patched line mentioning #679? Topically - in the end it is of course your decision. I cannot say, that I know all possible code beautifiers, but astyle is certainly only one of them. clang for example has something much more detailed, I'm not sure if it could break these kind of things. |
Yes, I meant a code comment like // do not remove the space after '<', see https://github.com/nlohmann/json/pull/679 This project currently only uses astyle. I could not find a way to mimic the options I use in clang-format. |
Thanks for the changes! |
Thanks! |
The original version can trigger a digraph-related warning in VS2015. Is this namespace construct a typo or something deliberate?
Files to change
There are currently two files which need to be edited:
src/json.hpp
test/src/unit.cpp
- This contains the Catch unit tests which currently cover 100 % of the library's code.If you add or change a feature, please also add a unit test to this file. The unit tests can be compiled and executed with
The test cases are also executed with several different compilers on Travis once you open a pull request.
Note
Please don't
#ifdef
s or other means.