[Bug c++/61414] enum class bitfield size-checking failure

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 28 23:04:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61414

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Xidorn Quan from comment #5)
> It seems G++ always throw that warning for enum class as bitfield, even when
> the enum class is actually empty:
> > enum class K {};
> > struct S {
> >   K v : 5;
> > };
> 
> G++ would give:
> > test.cpp:3:9: warning: 'S::v' is too small to hold all values of 'enum class K'
> >    K v : 5;

Yes, read comment 2.


More information about the Gcc-bugs mailing list