Skip to content

Commit

Permalink
Report the right __cplusplus value for MSVC in basic_json meta()
Browse files Browse the repository at this point in the history
  • Loading branch information
flagarde committed Apr 4, 2022
1 parent 33b75e5 commit 8bdfe53
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,10 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
result["compiler"] = {{"family", "unknown"}, {"version", "unknown"}};
#endif

#ifdef __cplusplus

#if defined(_MSVC_LANG)
result["compiler"]["c++"] = std::to_string(_MSVC_LANG);
#elif defined(__cplusplus)
result["compiler"]["c++"] = std::to_string(__cplusplus);
#else
result["compiler"]["c++"] = "unknown";
Expand Down

0 comments on commit 8bdfe53

Please sign in to comment.