On Wednesday, 27 March 2013 at 17:36:46 UTC, Steven Schveighoffer
wrote:
On Wed, 27 Mar 2013 13:32:06 -0400, deadalnix
<[email protected]> wrote:
On Wednesday, 27 March 2013 at 16:52:27 UTC, Nick Sabalausky
wrote:
Honestly, I hate that, too. The problem is that enum is
(unfortunately)
intended to do double-duty as a bitfield so you can do
something like
this:
enum Options
{
FeatureA = 0b0000_0001;
FeatureB = 0b0000_0010;
FeatureC = 0b0000_0100;
FeatureD = 0b0000_1000;
// etc...
}
// Use features A and C
auto myOptions = Options.FeatureA | Options.FeatureC;
That possibility means that D *can't* check for validity as
you suggest.
It can. myOptions is an int here, as Options would decay to
its base type.
No, it's not. try it. I thought as you did too until recently.
I knew the bug existed, but I thought it would be solved now. If
it is how the spec specify it, then it is a spec bug and a
compiler bug.