[Issue 9930] Disallow accessing enum members through enum instance

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Apr 16 11:04:13 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9930


Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|enhancement                 |normal


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-04-16 11:04:12 PDT ---
Note that this actually hides instance members:

struct S
{
    int a;  // hidden by member "a" in enum E
    bool opCmp(S s) { return 1; }
}

enum E : S
{
    a = S(1),
    b = S(2)
}

void main()
{
    E evar = E.a;
    assert(evar.a == 1);  // Error: evar.a is E here
}

I'm changing the report to a bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list