digitalmars.D.bugs - [Issue 10111] New: getProtection trait should work with inaccessible fields
- d-bugmail puremagic.com (41/42) May 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10111
- d-bugmail puremagic.com (13/16) May 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10111
- d-bugmail puremagic.com (14/14) May 17 2013 http://d.puremagic.com/issues/show_bug.cgi?id=10111
http://d.puremagic.com/issues/show_bug.cgi?id=10111 Summary: getProtection trait should work with inaccessible fields Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: andrej.mitrovich gmail.com 17:30:56 PDT --- ----- module foo; struct S { private void m() { } } ----- ----- module test; import foo; void main() { static if (__traits(getProtection, S.m != "private")) { // field might be accessible } } ----- $ dmd test.dtest.d(7): Error: struct foo.S member m is not accessibleThere's not much point in having this trait if it fails to compile due to accessibility problems. The trait has only one purpose and it's to return a string representation of a symbol's protection. There's nothing damaging about allowing it access to all fields, so I think the above should work. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10111 Igor Stepanov <wazar.leollone yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |wazar.leollone yahoo.com 17:35:58 PDT --- is this bug is regression? You was created an another issue: http://d.puremagic.com/issues/show_bug.cgi?id=9546static assert(__traits(getProtection, s.privA) == "private"); static assert(__traits(getProtection, s.protA) == "protected"); static assert(__traits(getProtection, s.packA) == "package");-- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 17 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10111 Andrej Mitrovic <andrej.mitrovich gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID 17:42:10 PDT --- God what a silly typo: static if (__traits(getProtection, S.m != "private")) The parenthesis is wrong, it should be: static if (__traits(getProtection, S.m) != "private") -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
May 17 2013