From 8bdfe53a0bc42b61d4c8f0a82829a0e7d5f7b570 Mon Sep 17 00:00:00 2001 From: flagarde Date: Mon, 4 Apr 2022 22:40:03 +0800 Subject: [PATCH] Report the right __cplusplus value for MSVC in basic_json meta() --- include/nlohmann/json.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 6bf77d507..7d4b67db4 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";