On Sat, 8 Nov 2014, Sandra Loosemore wrote:

> I thought that the point at which integral promotions are applied would be a
> good place to catch this, as it excludes places where bit-fields are already
> being converted by assignment or explicit cast.  I think we also want to

Formally of course that's the place where C and C++ differ, but 
practically that seems likely to catch cases such as

  sp->b <<= 1;

where the way the values are used means it doesn't actually matter what 
type was used (modulo undefined integer overflow cases).  It might avoid 
such unnecessary warnings if warnings were instead given at the time such 
a bit-field type wider than int is converted to a type wider than the 
bit-field, if the expression being converted is the result of some 
arithmetic operation rather than just a direct reference to a bit-field 
member of a structure.

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to