Skip to content

Commit 13de0a0

Browse files
committed
Use _MSVC_LANG macro
1 parent 85a6ba9 commit 13de0a0

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Include/pyport.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,10 +540,15 @@ extern "C" {
540540
//
541541
// On C23, use typeof(). On C++11, use decltype(). Otherwise, use __typeof__()
542542
// if on GCC, clang or MSVC 17.9 and newer.
543+
//
544+
// On MSVC, check also _MSVC_LANG since __cplusplus is 199711L unless
545+
// the /Zc:__cplusplus flag is used.
543546
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
544547
# define _Py_TYPEOF(expr) typeof(expr)
545548
#elif defined(__cplusplus) && __cplusplus >= 201103L
546549
# define _Py_TYPEOF(expr) decltype(expr)
550+
#elif defined(_MSVC_LANG) && _MSVC_LANG >= 201103L
551+
# define _Py_TYPEOF(expr) decltype(expr)
547552
#elif defined(__GNUC__) || defined(__clang__) || \
548553
(defined(_MSC_VER) && _MSC_VER >= 1939)
549554
# define _Py_TYPEOF(expr) __typeof__(expr)

0 commit comments

Comments
 (0)