mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
glib/glib-typeof: Ensure glib_typeof is defined in MSCV C++
When compiling with C++ in MSCV, it defines the __cplusplus macro, but that's set to an old value and it doesn't represent the current c++ standard version (unless when explicitly requested via `/Zc:__cplusplus`). So, to enable modern features we should rely on `_MSC_LANG` instead, which represent the value we care about.
This commit is contained in:
parent
c19904d6e8
commit
9b6cc47bcb
@ -34,9 +34,12 @@
|
||||
* This symbol is private.
|
||||
*/
|
||||
#undef glib_typeof
|
||||
#if (!defined(__cplusplus) || __cplusplus < 201103L) && (G_GNUC_CHECK_VERSION(4, 8) || defined(__clang__))
|
||||
#if (!defined(__cplusplus) || (!defined (_MSVC_LANG) && __cplusplus < 201103L)) && \
|
||||
(G_GNUC_CHECK_VERSION(4, 8) || defined(__clang__))
|
||||
#define glib_typeof(t) __typeof__ (t)
|
||||
#elif defined(__cplusplus) && __cplusplus >= 201103L && GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
|
||||
#elif defined(__cplusplus) && \
|
||||
(__cplusplus >= 201103L || (defined (_MSVC_LANG) && _MSVC_LANG > 201103L)) && \
|
||||
GLIB_VERSION_MIN_REQUIRED >= GLIB_VERSION_2_68
|
||||
/* C++11 decltype() is close enough for our usage */
|
||||
#include <type_traits>
|
||||
#define glib_typeof(t) typename std::remove_reference<decltype (t)>::type
|
||||
|
Loading…
Reference in New Issue
Block a user