================
@@ -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:

Good call, I'll add these tests. FWIW, I already show constant folding:
```
  // Constant folding works the same way as sizeof, too.
  const int m = 12;
  int other_array[m];
  static_assert(sizeof(other_array));   // expected-error {{static assertion 
expression is not an integral constant expression}}
  static_assert(_Countof(other_array)); // expected-error {{static assertion 
expression is not an integral constant expression}}
  static_assert(sizeof(int[m]));        // expected-error {{static assertion 
expression is not an integral constant expression}}
  static_assert(_Countof(int[m]));      // expected-error {{static assertion 
expression is not an integral constant expression}}
```
or did you have something else in mind?

https://github.com/llvm/llvm-project/pull/133125
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to