Skip to content

Commit

Permalink
fix: improve C++ version detection macros
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrechette committed May 19, 2024
1 parent 9fc8471 commit f872938
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions includes/rtm/impl/detect_cpp_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f872938

Please # to comment.