Bug 3999 and 4261

bearophile bearophileHUGS at lycos.com
Tue Aug 31 16:32:24 PDT 2010


A way to tell them apart is the presence of the EnumTag, if it's present, then the enum is a new type:

enum V1 = 10;
enum { V2 = 20 }
enum Foo { V3 }
void main() {
    assert(V1 == 10);    // OK
    assert(V2 == 20);    // OK
    assert(Foo.V3 == 0); // ERROR, type mismatch
}

Bye,
bearophile


More information about the Digitalmars-d mailing list