]> Savannah Git Hosting - gnulib.git/commitdiff
verify: Avoid syntax error due to static_assert with clang in C++ mode.
authorBruno Haible <bruno@clisp.org>
Sun, 18 Sep 2022 19:19:56 +0000 (21:19 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 18 Sep 2022 19:20:34 +0000 (21:20 +0200)
* lib/verify.h (static_assert): Don't define in clang C++ 6 or newer.

ChangeLog
lib/verify.h

index 432b125c852086e621ef436e3bb164ad8c5df44b..fb4a2a741db667794129e1e12438b3c85d3d0564 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2022-09-14  Bruno Haible  <bruno@clisp.org>
+
+       verify: Avoid syntax error due to static_assert with clang in C++ mode.
+       * lib/verify.h (static_assert): Don't define in clang C++ 6 or newer.
+
 2022-09-14  Bruno Haible  <bruno@clisp.org>
 
        verify: Avoid syntax error due to static_assert with MSVC 14 in C++.
index 3d2cb91d65a6eb802c9c2e3f300070f8d59eb866..42307c0be6bfabdd4dac74aa7cf5021c32cf7e07 100644 (file)
@@ -223,7 +223,10 @@ template <int w>
 #  define _Static_assert(R, ...) \
      _GL_VERIFY ((R), "static assertion failed", -)
 # endif
-# if __cpp_static_assert < 201411 && __GNUG__ < 6 && !defined static_assert
+# if (!defined static_assert \
+      && (!defined __cplusplus \
+          || (__cpp_static_assert < 201411 \
+              && __GNUG__ < 6 && __clang_major__ < 6)))
 #  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.