www.digitalmars.com         C & C++   DMDScript  

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


          Issue ID: 22011
           Summary: traits(getMember, Anything, "this") does not bypass
           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")));


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 2021