www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22011] New: traits(getMember, Anything, "this") does not

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: nobody puremagic.com
          Reporter: destructionator gmail.com

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.

--
Jun 09