https://issues.dlang.org/show_bug.cgi?id=22011
Issue ID: 22011
Summary: traits(getMember, Anything, "this") does not bypass
visibility
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Consider the following:
---
module bugtrait;
class A {
private this() {}
private void foo() {}
}
---
module bugtrait2;
import bugtrait;
void main() {
pragma(msg, __traits(getVisibility, __traits(getMember, A, "foo")));
pragma(msg, __traits(getVisibility, __traits(getMember, A, "this")));
}
---
private
Error: no property `this` for type `bugtrait.A`
The "foo" works fine, it bypasses private when getting the member, allowing me
to inspect its visibility, deprecation status, etc.
But then for "this", it fails, even though traits(allMembers) returns it,
causing an annoying special case.
--