+2025-06-07 Bruno Haible <bruno@clisp.org>
+
+ stdcountof-h: Work around a clang bug.
+ Reported by Basil L. Contovounesios <basil@contovou.net> in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2025-06/msg00073.html>.
+ * lib/stdcountof.in.h (_gl_verify_is_array): Disable the checking on
+ clang.
+ * tests/test-stdcountof-h.c (test_func): Add another test case.
+
2025-06-06 Collin Funk <collin.funk1@gmail.com>
doc: Add some missing Makefile targets.
# endif
#else
/* In C, we can use typeof and __builtin_types_compatible_p. */
-# if _GL_GNUC_PREREQ (3, 1) || defined __clang__
+/* Work around clang bug <https://github.com/llvm/llvm-project/issues/143284>. */
+# if _GL_GNUC_PREREQ (3, 1) && ! defined __clang__ /* || defined __clang__ */
# define _gl_verify_is_array(a) \
sizeof (struct { unsigned int _gl_verify_error_if_negative : __builtin_types_compatible_p (typeof (a), typeof (&*(a))) ? -1 : 1; })
# else
ASSERT (countof (unbounded) >= 0);
#endif
+ {
+ extern int a, b, c;
+ ASSERT (countof (((int[]) { a, b, c })) == 3);
+ }
+
/* Check that countof(...) is an expression of type size_t. */
#if !defined __cplusplus && HAVE__GENERIC
ASSERT (_Generic (countof (bounded), size_t: 1, default: 0));