You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I assume it complains because [[deprecated]] attribute was applied to definition. According to C++17 draft I have (10.6.4.p2):
The attribute may be applied to the declaration of a class, a typedef-name, a variable, a non-static data member, a function, a namespace, an enumeration, an enumerator, or a template specialization.
Looks like MS read it as "can't happen on a definition". I have no opinion about correctness of this position.
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.
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.
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 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.
/*
TODO: remove _MSC_VER when this is fixed.
https://github.com/nlohmann/json/issues/1695
*/
#if defined(__cplusplus) && (__cplusplus >= 201402L) && !defined(_MSC_VER)
#define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]])
#define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]])
#elif \
And regarding closing this issue because its "stale", I guess its a novel approach to solving issues, just close them after 31 days.
@t-b
I had compared the current version and the newest version of hedley.
There are not a lot of differences or special changes. So it maybe ok to update the source codes.
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.
Activity
jaredgrubb commentedon Jul 31, 2019
I don't see why there is any bug here. Can you explain why the deprecated attribute is not legal in that context?
crusader-mike commentedon Jul 31, 2019
I assume it complains because
[[deprecated]]attribute was applied to definition. According to C++17 draft I have (10.6.4.p2):Looks like MS read it as "can't happen on a definition". I have no opinion about correctness of this position.
jaredgrubb commentedon Aug 1, 2019
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 :)
stale commentedon Sep 2, 2019
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.
crusader-mike commentedon Sep 3, 2019
Bad bot!
t-b commentedon Sep 3, 2019
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.
crusader-mike commentedon Sep 4, 2019
or I could simply patch this lib in my
vcpkginstance and avoid dealing with PR/etc ;)stale commentedon Oct 4, 2019
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.
mrstux commentedon Oct 23, 2019
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.
12 remaining items
LanderlYoung commentedon Mar 4, 2020
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.
t-b commentedon Mar 18, 2020
@LanderlYoung The upstream bug in hedley was fixed.
@nlohmann How do I upgrade to a newer hedley version?
dota17 commentedon Mar 18, 2020
@t-b
I had compared the current version and the newest version of hedley.
There are not a lot of differences or special changes. So it maybe ok to update the source codes.
nlohmann commentedon Mar 19, 2020
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 ?
t-b commentedon Mar 19, 2020
@nlohmann Yeep, I've rebased #1958.
kenr commentedon Jun 2, 2020
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.
nlohmann commentedon Jun 3, 2020
The next release will be version 3.8.0. I'm not sure how much more time I will need until it is ready.
kenr commentedon Jun 4, 2020
@nlohmann Is there anything I can help out with towards the 3.8.0 release?
nlohmann commentedon Jun 4, 2020
Not really - but if you are using MSVC and want to help, you may want to have a look at #2117.
Refs microsoft#15: Revert "[nlohmann-json] Upgrade to 3.7.3"
Refs microsoft#15: Revert "[nlohmann-json] Update to 3.7.0 (microsoft…