[Issue 14740] __traits(allMembers) returns erroneous 'this' member for types declared in functions.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 6 00:51:53 PDT 2015


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

--- Comment #2 from Mihail.K at fimu.tk ---
(In reply to Kenji Hara from comment #1)
> (In reply to Mihail.K from comment #0)
> > __traits(allMembers) returns an additional non-existent member named 'this'
> > for types declared inside of functions.
> 
> That's actually exists. It's an instance field which implicitly inserted by
> compiler, in order to capture the outer context of nested structs and
> classes.

Well, it's not accessible in any way, and trying to reference it through the
getMember trait fails. It should either not be returned in the list, or should
be accessible. 

As it is, all it does is cause a compiler error, unless you add special
handling for that specific case.

--


More information about the Digitalmars-d-bugs mailing list