diff options
Diffstat (limited to 'lib/verify.h')
-rw-r--r-- | lib/verify.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/verify.h b/lib/verify.h index c700243209..e4af91517e 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -241,10 +241,16 @@ template <int w> # define _Static_assert(...) \ _GL_VERIFY (__VA_ARGS__, "static assertion failed", -) # else - /* Work around MSVC preprocessor incompatibility with ISO C; see - <https://stackoverflow.com/questions/5134523/>. */ -# define _Static_assert(R, ...) \ - _GL_VERIFY ((R), "static assertion failed", -) +# if defined __cplusplus && _MSC_VER >= 1910 + /* In MSVC 14.1 or newer, static_assert accepts one or two arguments, + but _Static_assert is not defined. */ +# define _Static_assert static_assert +# else + /* Work around MSVC preprocessor incompatibility with ISO C; see + <https://stackoverflow.com/questions/5134523/>. */ +# define _Static_assert(R, ...) \ + _GL_VERIFY ((R), "static assertion failed", -) +# endif # endif # endif /* Define static_assert if needed. */ @@ -252,7 +258,7 @@ template <int w> && __STDC_VERSION__ < 202311 \ && (!defined __cplusplus \ || (__cpp_static_assert < 201411 \ - && __GNUG__ < 6 && __clang_major__ < 6))) + && __GNUG__ < 6 && __clang_major__ < 6 && _MSC_VER < 1910))) # if defined __cplusplus && _MSC_VER >= 1900 && !defined __clang__ /* MSVC 14 in C++ mode supports the two-arguments static_assert but not the one-argument static_assert, and it does not support _Static_assert. |