| Thread overview | ||||||
|---|---|---|---|---|---|---|
|
June 10, 2021 [Issue 22011] traits(getMember, Anything, "this") does not bypass visibility | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22011 João Lourenço <jlourenco5691@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jlourenco5691@gmail.com --- Comment #1 from João Lourenço <jlourenco5691@gmail.com> --- ```d pragma(msg, __traits(getVisibility, __traits(getMember, A, "__ctor"))); ``` -- | ||||
June 10, 2021 [Issue 22011] traits(getMember, Anything, "this") does not bypass visibility | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22011 --- Comment #2 from Adam D. Ruppe <destructionator@gmail.com> --- __ctor is not returned by allMembers and is not supposed to be used anyway, since the double leading underscore is a reserved detail to the compiler implementation. -- | ||||
June 10, 2021 [Issue 22011] traits(getMember, Anything, "this") does not bypass visibility | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22011 --- Comment #3 from Adam D. Ruppe <destructionator@gmail.com> --- It also doesn't work if the constructor is auto-generated instead of explicitly put in anyway. -- | ||||
June 16, 2021 [Issue 22011] traits(getMember, Anything, "this") does not bypass visibility | ||||
|---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=22011 Mathias LANG <pro.mathias.lang@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |pro.mathias.lang@gmail.com Resolution|--- |INVALID --- Comment #4 from Mathias LANG <pro.mathias.lang@gmail.com> --- The bug is not about visibility, but trying to use `this` to access the ctor. If you make `this` public, you'll still get the same error message. > __ctor is not returned by allMembers It is. https://dlang.org/spec/traits.html#allMembers We use it directly because there's no alternative. > But then for "this", it fails, even though traits(allMembers) returns it, causing an annoying special case. When I add: > pragma(msg, __traits(allMembers, A)); After the other, I get: > tuple("__ctor", "foo", "toString", "toHash", "opCmp", "opEquals", "Monitor", "factory") How do you get the `"this"` ? -- | ||||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply