[clang] [C2y] Implement WG14 N3369 and N3469 (_Countof) (PR #133125)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 27 04:40:24 PDT 2025
================
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c2y -pedantic -Wall -Wno-comment -verify %s
+
+/* WG14 N3369: Clang 21
+ * _Lengthof operator
+ *
+ * Adds an operator to get the length of an array. Note that WG14 N3469 renamed
+ * this operator to _Countof.
+ */
----------------
AaronBallman wrote:
> `_Countof array`
FWIW, this is already covered by:
```
void test_constant_expression_behavior(int n) {
static_assert(_Countof(global_array) == 12);
static_assert(_Countof global_array == 12); // This one
static_assert(_Countof(int[12]) == 12);
}
```
https://github.com/llvm/llvm-project/pull/133125
More information about the cfe-commits
mailing list