[Issue 10111] New: getProtection trait should work with inaccessible fields
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri May 17 17:30:57 PDT 2013
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 at puremagic.com
ReportedBy: andrej.mitrovich at gmail.com
--- Comment #0 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-05-17 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.d
> test.d(7): Error: struct foo.S member m is not accessible
There'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: -------
More information about the Digitalmars-d-bugs
mailing list