www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19410] New: Inconsistency between __traits(allMembers) and


          Issue ID: 19410
           Summary: Inconsistency between __traits(allMembers) and
                    __traits(hasMember) for nested structs
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: stanislav.blinov gmail.com

void main() {
    struct S {
        ~this() {}

    foreach (name; __traits(allMembers, S))
        static assert(__traits(hasMember, S, name));

The above will assert: __traits(allMembers) reports that S has a member "this"
(the context pointer), but __traits(hasMember) insists that it doesn't.

Perhaps "this" could be renamed to "__context", and made visible to

Nov 18 2018