File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -538,12 +538,15 @@ extern "C" {
538538//
539539// Example: _Py_TYPEOF(x) x_copy = (x);
540540//
541- // On C23, use typeof(). Otherwise, the macro is only defined
542- // if GCC or clang compiler is used.
541+ // On C23, use typeof(). Otherwise __typeof__() if on GCC, clang or
542+ // MSVC 17.9 and newer. Else if on C++11 or newer, decltype() is used.
543543#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
544544# define _Py_TYPEOF (expr ) typeof (expr)
545- #elif defined(__GNUC__) || defined(__clang__)
545+ #elif defined(__GNUC__) || defined(__clang__) || \
546+ (defined (_MSC_VER) && _MSC_VER >= 1939 )
546547# define _Py_TYPEOF (expr ) __typeof__(expr)
548+ #elif defined(__cplusplus) && __cplusplus >= 201103L
549+ # define _Py_TYPEOF (expr ) decltype (expr)
547550#endif
548551
549552
You can’t perform that action at this time.
0 commit comments