[clang] [Sema] Add check for bitfield assignments to larger integral types (PR #68276)

via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 6 08:11:22 PDT 2023


================
@@ -6171,6 +6171,9 @@ def warn_signed_bitfield_enum_conversion : Warning<
   "signed bit-field %0 needs an extra bit to represent the largest positive "
   "enumerators of %1">,
   InGroup<BitFieldEnumConversion>, DefaultIgnore;
+def warn_bitfield_too_small_for_integral_type : Warning<
+  "bit-field %0 (%1 bits) is not wide enough to store type of %2 ">,
+  InGroup<Conversion>, DefaultIgnore;
----------------
vabridgers wrote:

Thanks @erichkeane, understood. I'm thinking this warning should be disabled by default and then explicitly enabled only if the user wants to enable it. Do you agree, or have different ideas about the use cases?

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


More information about the cfe-commits mailing list