================
@@ -49,7 +49,7 @@ struct ExprDependenceScope {
 using ExprDependence = ExprDependenceScope::ExprDependence;
 
 struct TypeDependenceScope {
-  enum TypeDependence : uint8_t {
+  enum TypeDependence : unsigned {
----------------
cor3ntin wrote:

I had a chat with @Endilll offline.
The reason for this change is that `preferred_type` (#69104) warns when the 
enumerator has a different underlying type as the bit field. 
https://godbolt.org/z/zz99s6M3j

This warning does seem a bit off to me - but I really like its intent.
The warning only triggers on enumerators (which probably make sense as a 
general warning may have too many false positives), but I think the warning is 
too restrictive.
If the underlying type has the same signedness and has a size equal to **or 
smaller**  than the the size of the type of the bitfield, I don't think a 
warning should be produced.

I have convinced myself that the changes here are most likely fine 
(`TypeDependence` is (afaict) only stored in TypeBitfields, as far as i can 
tell, and this uses the number of bits of the greatest enumerator, which i did 
not initially realize).

Yet I do not like the idea that we would change the underlying type of all 
enums used in bitfields for the sake of that warning.

My preferred solution would be to make `-Wbitfield-type` less aggressive and 
not change the underlying types of enums is this patch.





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

Reply via email to