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: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Andrej Mitrovic <[email protected]> 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: -------