Skip to content
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

C++14 support is not enabled with msvc2015 #1932

Closed
Predelnik opened this issue Feb 10, 2020 · 3 comments
Closed

C++14 support is not enabled with msvc2015 #1932

Predelnik opened this issue Feb 10, 2020 · 3 comments
Labels
platform: visual studio related to MSVC solution: invalid the issue is not related to the library state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated

Comments

@Predelnik
Copy link

_HAS_CXX14 is never defined by MSVC
Proof:
https://gcc.godbolt.org/z/5odXyR

Also you may check that Microsoft STL uses only _HAS_CXX17

So second half of check for C++14 version support is incorrect (never triggered):

#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)

What it leads to - on older msvc's which was not defining __cplusplus properly (at least on msvc2015) C++14 is never treated as supported even though it is supported. Currently it only disables usage of transparent comparator.

Unfortunately it seems there is no correct way to check for C++14 support for msvc since lowest value of their language switch is also c++14 but more or less it was supported starting from VS2015 and since it is the lowest version library supports, maybe treating C++14 as always supported by msvc is the best option?

@nlohmann
Copy link
Owner

If this is a bug in MSVC, then I am afraid I can do nothing in this library. Any ideas?

@nlohmann nlohmann added solution: invalid the issue is not related to the library and removed kind: bug labels Feb 15, 2020
@Predelnik
Copy link
Author

I would not say it's a msvc bug per se, it's just that current check (_HAS_CXX14 etc.) doesn't mean anything when compiling with msvc. Basically, msvc starting from 2015 supports c++14 unconditionally with any compilation flags, previous versions probably do not support it.

So in my opinion considering that minimum supported msvc version of the library is 2015, just replacing

 || (defined(_HAS_CXX14) && _HAS_CXX14 == 1)

with

|| defined (_MSC_VER)

should be fine.

@stale
Copy link

stale bot commented Mar 17, 2020

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.

@stale stale bot added the state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated label Mar 17, 2020
@stale stale bot closed this as completed Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: visual studio related to MSVC solution: invalid the issue is not related to the library state: stale the issue has not been updated in a while and will be closed automatically soon unless it is updated
Projects
None yet
Development

No branches or pull requests

2 participants