* Re: Strongly typed enums as bit fields
[not found] <CAJXPUYLcHEO5rMjF+BJK+5oHOePvMj8zxDU7SGZP=RezL8uR1A@mail.gmail.com>
@ 2011-11-20 9:06 ` Владимир Андреев
2011-11-20 18:17 ` Jonathan Wakely
0 siblings, 1 reply; 4+ messages in thread
From: Владимир Андреев @ 2011-11-20 9:06 UTC (permalink / raw)
To: gcc-help
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Strongly typed enums as bit fields
2011-11-20 9:06 ` Strongly typed enums as bit fields Владимир Андреев
@ 2011-11-20 18:17 ` Jonathan Wakely
2011-11-21 4:38 ` Владимир Андреев
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2011-11-20 18:17 UTC (permalink / raw)
To: Владимир
Андреев
Cc: gcc-help
2011/11/20 Владимир Андреев:
>
> 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?
I think this should be valid, the standard says "A bit-field shall have
integral or enumeration type (3.9.1)."
Please report it to bugzilla, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Strongly typed enums as bit fields
2011-11-20 18:17 ` Jonathan Wakely
@ 2011-11-21 4:38 ` Владимир Андреев
2011-11-21 4:47 ` Jonathan Wakely
0 siblings, 1 reply; 4+ messages in thread
From: Владимир Андреев @ 2011-11-21 4:38 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: gcc-help
Today I have tested Intel C++ Compiler - that is OK.
Additionally I noted, that GCC doesn't support declaration like
using NewType = OldType;
which semantically equals to
typedef OldType NewType;
2011/11/20 Jonathan Wakely <jwakely.gcc@gmail.com>:
> 2011/11/20 Владимир Андреев:
>>
>> 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?
>
> I think this should be valid, the standard says "A bit-field shall have
> integral or enumeration type (3.9.1)."
>
> Please report it to bugzilla, thanks.
>
--
С уважением, Владимир
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Strongly typed enums as bit fields
2011-11-21 4:38 ` Владимир Андреев
@ 2011-11-21 4:47 ` Jonathan Wakely
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2011-11-21 4:47 UTC (permalink / raw)
To: Владимир
Андреев
Cc: gcc-help
2011/11/20 Владимир Андреев :
> Additionally I noted, that GCC doesn't support declaration like
>
> using NewType = OldType;
>
> which semantically equals to
>
> typedef OldType NewType;
Yes it does, but that was only added last week.
Thanks for the Bugzilla report.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-20 20:23 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CAJXPUYLcHEO5rMjF+BJK+5oHOePvMj8zxDU7SGZP=RezL8uR1A@mail.gmail.com>
2011-11-20 9:06 ` Strongly typed enums as bit fields Владимир Андреев
2011-11-20 18:17 ` Jonathan Wakely
2011-11-21 4:38 ` Владимир Андреев
2011-11-21 4:47 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).