diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 6bf77d507..496007c0d 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -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"; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index ba272a126..33a91164c 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -17505,7 +17505,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";