Bit-fields of enum type

Владимир Андреев volodya@netfolder.ru
Sun Nov 18 13:51:00 GMT 2012


Hello, All!

Some months ago I already wrote, I have an error while compilling
programs, which uses structs with bit-fields of strongly typed enums.

For example:

enum class E1: char
{
  V1 = 5, V2 = 10
};

enum class E2: char
{
  V1 = 7, V2 = 15
};

struct A
{
  E1 f1: 5;
  E2 f2: 3;
};

GCC writes:

error: bit-field 'f1' with non-integral type

error: bit-field 'f2' with non-integral type


Will GCC support such features of C++11?

--
With best regards, Vladimir



More information about the Gcc-help mailing list