digitalmars.D.bugs - [Issue 9930] New: Disallow accessing enum members through enum instance
- d-bugmail puremagic.com (34/34) Apr 14 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9930
- d-bugmail puremagic.com (26/26) Apr 16 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9930
- d-bugmail puremagic.com (20/20) Jun 03 2013 http://d.puremagic.com/issues/show_bug.cgi?id=9930
http://d.puremagic.com/issues/show_bug.cgi?id=9930 Summary: Disallow accessing enum members through enum instance Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: enhancement Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 08:28:02 PDT --- enum E { A, B } void main() { E e; if (e.A) // should have been "if e == E.A" { } } This compiles, and it was a bug in my code. I don't see the benefit of being able to access enum member through the instance instead of through the type. So I think the above should become an error. Of course "if (E.A)" through the type is and will be allowed to compile, but the above might just catch a bug or two in user-code (it certainly wasted my time tracking down the bug). -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Apr 14 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9930 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal 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: -------
Apr 16 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9930 10:03:19 PDT --- To make sure Issue 10253 is implementable, I'd still like the following to work (which currently does): ----- enum E { A, B } struct S { E e; alias e this; } auto x = S.A; // equivalent to S.e.A, or E.A ----- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 03 2013