[PATCH] D30923: Warn on enum assignment to bitfields that can't fit all values

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 13 18:30:18 PDT 2017

rnk marked an inline comment as done.
rnk added inline comments.

Comment at: test/Sema/warn-bitfield-enum-conversion.c:3
+enum TwoBits { Hi1 = 3 } two_bits;
+enum TwoBitsSigned { Lo2 = -2, Hi2 = 1 } two_bits_signed;
thakis wrote:
> can you add an enum with an explicit underlying type? will this warning always fire for those?
I was worried for a moment, but it looks like `EnumDecl::getNumPositiveBits` does what I want and ignores the fixed underlying type.


More information about the cfe-commits mailing list