From: John Keeping Date: Wed, 16 Jan 2013 23:08:00 GMT Subject: Re: [PATCH 1/2] fix clang -Wconstant-conversion with bit fields Message-ID: <20130116230800.GB4574@serenity.lan> In-Reply-To: <1358376443-7404-1-git-send-email-apelisse@gmail.com> On Wed, Jan 16, 2013 at 11:47:22PM +0100, Antoine Pelisse wrote: > clang incorrectly reports a constant conversion warning (implicit > truncation to bit field) when using the "flag &= ~FLAG" form, because > ~FLAG needs to be truncated. > > Convert this form to "flag = flag & ~FLAG" fixes the issue as > the right operand now fits into the bit field. > > Signed-off-by: Antoine Pelisse > --- > I'm sorry about this fix, it really seems bad, yet it's one step closer > to warning-free clang compilation. > > It seems quite clear to me that it's a bug in clang. Which version of clang did you see this with? I don't get these warnings with clang 3.2. John