ojhunt wrote:

> > This does mean that if the preferred and explicit types have different 
> > storage requirements we may not warn in all possible cases, but that's a 
> > scenario for which the warnings are much more complex and confusing
> 
> If I understand the patch correctly, we always warn, but about the wrong 
> thing.
> 
> Should we pick the minimum of both sizes? Should we make it an error for a 
> bit-field to be _larger_ than the prefered type?

I've done a bunch of messing around, the error handling and semantics become 
super terrible pretty quickly.

I think these semantics work for the general use case - "it's an integer 
actually containing an enum" - even though it could be an enum type with a 
different enum type as the preferred type.

I think a follow on patch should add gcc like semantics where we just warn at 
the declaration, and then it becomes much easier to say "the preferred and real 
type must both fit in the bitfield" at the point of the declaration.

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

Reply via email to