[clang] Add more tests for _Countof (PR #133333)

Alejandro Colomar via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 7 05:28:11 PDT 2025


================
@@ -121,10 +150,14 @@ void test_typedefs() {
   static_assert(_Countof(*x) == 12);
 }
 
-void test_zero_size_arrays() {
+void test_zero_size_arrays(int n) {
   int array[0]; // expected-warning {{zero size arrays are an extension}}
   static_assert(_Countof(array) == 0);
   static_assert(_Countof(int[0]) == 0); // expected-warning {{zero size arrays are an extension}}
+  int multi_array[0][n]; // expected-warning {{zero size arrays are an extension}}
----------------
alejandro-colomar wrote:

Thanks!  I've marked it with a FIXME comment.

https://github.com/llvm/llvm-project/pull/133333


More information about the cfe-commits mailing list