]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
stdcountof-h tests: Avoid compilation error in C++ mode.
authorBruno Haible <bruno@clisp.org>
Wed, 14 Jan 2026 22:26:51 +0000 (23:26 +0100)
committerBruno Haible <bruno@clisp.org>
Wed, 14 Jan 2026 22:26:51 +0000 (23:26 +0100)
* tests/test-stdcountof-h.c (test_func): Don't test ISO C initializer
syntax in C++ mode.

ChangeLog
tests/test-stdcountof-h.c

index 182e2010511102820bcca4e8f9688118d4d31b2e..a423f2915aaf7bdfaf1f293b5479dc756e2478d5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2026-01-14  Bruno Haible  <bruno@clisp.org>
+
+       stdcountof-h tests: Avoid compilation error in C++ mode.
+       * tests/test-stdcountof-h.c (test_func): Don't test ISO C initializer
+       syntax in C++ mode.
+
 2026-01-13  Paul Eggert  <eggert@cs.ucla.edu>
 
        maint: pacify -Wdiscarded-qualifiers
index 191ba5c7796ba1604dc553a8b3e6798b628ce0fb..03498ae99dcc041bf17b6c92c728e83185caec7a 100644 (file)
@@ -78,8 +78,12 @@ test_func (int parameter[3])
   ASSERT (countof (unbounded) >= 0);
 #endif
 
+  /* Avoid MSVC C++ error C4576 "a parenthesized type followed by an
+     initializer list is a non-standard explicit type conversion syntax".  */
+#if !defined __cplusplus
   ASSERT (countof ((int[]) { integer, integer, integer }) == 3);
   ASSERT (countof (((int[]) { integer, integer, integer })) == 3);
+#endif
 
   /* Check that countof(...) is an expression of type size_t.  */
 #if !defined __cplusplus && HAVE__GENERIC