March 14, 2014 [Issue 12363] New: getProtection trait doesn't work for certain kinds of fields (and is poorly designed...) | ||||
---|---|---|---|---|
| ||||
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: nobody@puremagic.com ReportedBy: jakobovrum@gmail.com --- Comment #0 from Jakob Ovrum <jakobovrum@gmail.com> 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: ------- |
Copyright © 1999-2021 by the D Language Foundation