[clang] [BoundsSafety][Sema] Disallow using a bitfield as the counter (PR #231591)

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 13 11:50:34 PDT 2026


================
@@ -7208,6 +7208,8 @@ def err_count_attr_must_be_in_structure : Error<
   "field %0 in '%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}1' not inside structure">;
 def err_count_attr_argument_not_integer : Error<
   "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}0' requires a non-boolean integer type argument">;
+def err_count_attr_argument_is_bitfield : Error<
+  "'%select{counted_by|sized_by|counted_by_or_null|sized_by_or_null}0' cannot have a bitfield type argument">;
----------------
bwendling wrote:

With this error, the code will never get to the point where it's generating LLVM IR.

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


More information about the cfe-commits mailing list