https://d.puremagic.com/issues/show_bug.cgi?id=12363
Summary: getProtection trait doesn't work for certain kinds of
fields (and is poorly designed...)
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: [email protected]
ReportedBy: [email protected]
--- Comment #0 from Jakob Ovrum <[email protected]> 2014-03-14 04:39:30 PDT
---
Example:
---
alias TemplateArgumentList(T...) = T;
struct S
{
alias T = TemplateArgumentList!(int, float);
}
pragma(msg, __traits(getProtection, __traits(getMember, S, "T")));
---
Output:
---
test.d(8): Error: argument int has no protection
false
---
getProtection's interface is simply poorly designed. As exemplified by the
plethora of reports relating to it, it's tricky to use correctly, and as shown
above, it fails to support all kinds of symbols. The latter means this is a
bug, not an enhancement.
The interface should probably be:
__traits(getProtection, <aggregate>, <symbolName>)
Which should also succeed for inaccessible symbols. That way, both of
getProtection's problems are solved.
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------