[Issue 12363] getProtection trait doesn't work for certain kinds of fields (and is poorly designed...)

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Nov 17 01:50:47 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=12363

Jonathan M Davis <issues.dlang at jmdavisProg.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |issues.dlang at jmdavisProg.co
                   |                            |m

--- Comment #2 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
This just came up in the learn newsgroup again:

---
struct bar {
     public alias pubInt = int;
     private alias privInt = int;
}

static foreach(member ; __traits(allMembers, bar)) {
     // Error: argument `int` has no visibility
     pragma(msg, __traits(getVisibility, __traits(getMember, bar, member)));
}
---

I would guess that the core problem here is that the alias gets replaced with
what it's an alias to before getVisibility actually operates on it, which is
obviously the wrong order to do things in.

--


More information about the Digitalmars-d-bugs mailing list