-
-
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
/Zc:__cplusplus leads to C2416 #1695
Comments
I don't see why there is any bug here. Can you explain why the deprecated attribute is not legal in that context? |
I assume it complains because
Looks like MS read it as "can't happen on a definition". I have no opinion about correctness of this position. |
Yeh, that's a nuance that I can't make a call on myself. Dumb fix would be just to disable C2416 for this file :) |
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. |
Bad bot! |
Not sure how the project rules here are with respect to selectively disabling warnings but why not propose a PR which uses pragma push/pop logic for MSVC to disable that warning for this piece of code? See https://stackoverflow.com/a/18463996 as a starting point. |
or I could simply patch this lib in my |
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. |
I'm seeing this too. I tried disabling the warning via the push/pop mechanism, but it seems the compiler front-end doesn't understand that its a compiler warning, and the website doesn't document it either. In the end I added a check for MSVC to the deprecated language checks. Oh well. A bit hacky, but unblocking.
And regarding closing this issue because its "stale", I guess its a novel approach to solving issues, just close them after 31 days. |
This should be fixed on develop branch as it contains an updated version of Hedley. Can anyone try this? |
I've added a PR which compiles with |
Fails in CI as well, see https://ci.appveyor.com/project/nlohmann/json/builds/28319126/job/qp8uvagt7i56g5bp. @mrstux The best thing here is to fix the issue in https://github.com/nemequ/hedley, then incorporat the changes into the linked PR. |
It's not about the definition. MSVC chokes on the friend. Using "__declspec(deprecated)" does not trigger the warning. see https://godbolt.org/z/lhPjC-. |
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. |
@nlohmann Please reopen. |
Is there any progress here? As far as I know, the easy way is to disable the attribute for windows by: #if defined(__cplusplus) && (__cplusplus >= 201402L) && !defined(_MSC_VER) BTW: MSVC sucks on this and the __cplusplus Marco bug. Also, once MSVC fixed it, the last condition can be checking _MSC_VER range. |
@LanderlYoung The upstream bug in hedley was fixed. @nlohmann How do I upgrade to a newer hedley version? |
@t-b |
I upgraded Hedley to version 13 in https://github.com/nlohmann/json/tree/feature/update_hedley - can someone check if this fixes this issue? @t-b ? |
Is the 3.7.4/3.4.0 release with this fix planned anytime soon? I use bitsery with std::variant and that requires /Zc:__cplusplus for MSVC to set the correct __cplusplus value for C++17. |
The next release will be version 3.8.0. I'm not sure how much more time I will need until it is ready. |
@nlohmann Is there anything I can help out with towards the 3.8.0 release? |
Not really - but if you are using MSVC and want to help, you may want to have a look at #2117. |
This reverts commit ef90276. Because 3.7.3 does not build with MSVC 2017. See nlohmann/json#1695 for details.
…#7459)" This reverts commit 67dd3a8. Because 3.7.0 does not build with MSVC 2017. See nlohmann/json#1695 for details.
OS: Windows 7
Compiler: MSVC 2017 (15.9.11)
If project uses
/Zc:__cplusplus
json lib v3.7.0 fails to compile with this:Looks like MSVC doesn't like this attribute applied to operator>> definition.
The text was updated successfully, but these errors were encountered: