diff --git a/includes/rtm/impl/detect_cpp_version.h b/includes/rtm/impl/detect_cpp_version.h index ea57de81..1d752c02 100644 --- a/includes/rtm/impl/detect_cpp_version.h +++ b/includes/rtm/impl/detect_cpp_version.h @@ -27,14 +27,16 @@ ////////////////////////////////////////////////////////////////////////// // Macros to identify individual C++ versions ////////////////////////////////////////////////////////////////////////// -#if defined(__cplusplus) && __cplusplus >= 202002L - #define RTM_CPP_VERSION __cplusplus +#if defined(_MSVC_LANG) + // Test MSVC first since it used to define __cplusplus to some old version by default + + #define RTM_CPP_VERSION _MSVC_LANG #define RTM_CPP_VERSION_14 201402L #define RTM_CPP_VERSION_17 201703L #define RTM_CPP_VERSION_20 202002L -#elif defined(_MSVC_LANG) && _MSVC_LANG >= 202002L - #define RTM_CPP_VERSION _MSVC_LANG +#elif defined(__cplusplus) + #define RTM_CPP_VERSION __cplusplus #define RTM_CPP_VERSION_14 201402L #define RTM_CPP_VERSION_17 201703L