[Issue 22011] New: traits(getMember, Anything, "this") does not bypass visibility

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 10 02:09:12 UTC 2021


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


More information about the Digitalmars-d-bugs mailing list