>-----------------------------------------------
>enum State { ZERO, ONE, TWO };
[quoted text clipped - 14 lines]
>assignment, and fails the comparison with two. Do you have a workaround for a
>situation like this?
Other than not using the enum as the bitfield type or otherwise
fiddling with the value, I'm afraid not.
>GCC works as expected.
I can imagine reasons for both possibilities, but I'm not familiar
enough with the C++ standards to know what it really should be.
Carl, can you comment on this?
Dave

Signature
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Carl Daniel [VC++ MVP] - 27 Sep 2004 14:54 GMT
>> GCC works as expected.
>
> I can imagine reasons for both possibilities, but I'm not familiar
> enough with the C++ standards to know what it really should be.
>
> Carl, can you comment on this?
It's a bug (thatnks for reminding me). 9.6/4 says very plainly:
"If the value of an enumerator is stored into a bitfield of the same
enumeration type and the number of bits in the bitfield is large enough to
hold all the values of that enumeration type, the original enumerator value
and the value of the bitfield shall compare equal."
I don't have a VS 2005 installation handy to test this - if it's still
broken there, go ahead and open a bug report for it.
-cd
David Lowndes - 27 Sep 2004 21:58 GMT
>I don't have a VS 2005 installation handy to test this - if it's still
>broken there, go ahead and open a bug report for it.
It's still wrong in the B1 compiler, so I've created the following
report:
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=f4f95
27b-0c4b-45fc-a4dd-39bd490673f1
Dave

Signature
MVP VC++ FAQ: http://www.mvps.org/vcfaq
Giovanni Bajo - 27 Sep 2004 23:31 GMT
>> I don't have a VS 2005 installation handy to test this - if it's still
>> broken there, go ahead and open a bug report for it.
>
> It's still wrong in the B1 compiler, so I've created the following
> report:
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=f4f95
27b-0c4b-45fc-a4dd-39bd490673f1
Cute, I did not know MS now had a public database for bugs. This is a very
good move.
Thanks for filing this.

Signature
Giovanni Bajo
David Lowndes - 28 Sep 2004 07:26 GMT
>http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=f4f95
27b-0c4b-45fc-a4dd-39bd490673f1
>
>Cute, I did not know MS now had a public database for bugs. This is a very
>good move.
If you've not already done so, you might want to add a "vote" to the
bug report to help it on its way.
Dave

Signature
MVP VC++ FAQ: http://www.mvps.org/vcfaq