This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Strongly typed enums as bit fields
- From: ÐÐÐÐÐÐÐÑ ÐÐÐÑÐÐÐ <volodya at netfolder dot ru>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 20 Nov 2011 11:32:38 +0400
- Subject: Re: Strongly typed enums as bit fields
- References: <CAJXPUYLcHEO5rMjF+BJK+5oHOePvMj8zxDU7SGZP=RezL8uR1A@mail.gmail.com>
Hello all!
I try to compile the following test program using GCC 4.6.1:
enum class MyEnum: unsigned char
{
 A = 1,
 B = 2
};
struct MyClass
{
 MyEnum Field1: 3;
 unsigned char Field2: 5;
};
int main()
{
 MyClass Class;
}
but have error:
C:\MinGW\bin>gcc E:/Test/Main.cpp -o E:/Test/Out.exe -std=c++0x
E:/Test/Main.cpp:9:18: error: bit-field 'Field1' with non-integral type
MSVC 11.0 normally processes this program.
Why GCC throws this error and MCVC doesn't?
--
With regards, Vladimir