[Issue 15425] std.traits.hasIndirections fails to recognize nested structs

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Aug 31 05:17:50 PDT 2017


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305 at gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
Maybe I am getting this wrong, but both S1 and S2 are free of indirections for
as far as I can tell. Even if the sizeof includes the context pointer, it is
not a user defined part of the struct.

hasIndirections does the following for structs:

static if (is(T == struct) || is(T == union))
    enum hasIndirections = anySatisfy!(.hasIndirections, FieldTypeTuple!T);

As you can see, all the field types are tested (the context pointer is not an
actual field of the struct), so in my opinion the output of your program is
correct.

--


More information about the Digitalmars-d-bugs mailing list