[Issue 15094] __traits(getMember) fails when the source is a struct/class field

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue May 31 07:32:38 PDT 2016


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

Eyal Lotem <eyal.lotem at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eyal.lotem at gmail.com

--- Comment #5 from Eyal Lotem <eyal.lotem at gmail.com> ---
Even after applying the PR
(https://github.com/D-Programming-Language/dmd/pull/5215):

```
struct S { int i; }
S s;

unittest {
    import std.meta : Alias;

    alias GetMember1 =
        Alias!(__traits(getMember, mixin(__MODULE__), "s"));
    alias GetMember2 =
        Alias!(__traits(getMember, GetMember1, "i"));
    alias GetMember3 =
        Alias!(__traits(getMember,
                        __traits(getMember, mixin(__MODULE__), "s"),
                        "i"));

    // Works:
    auto a1 = &GetMember1;
    // Fails:
    auto a2 = &GetMember2;
    // Fails:
    auto a3 = &GetMember3;
    // Works:
    auto a4 =
        &__traits(getMember,
                  __traits(getMember, mixin(__MODULE__), "s"),
                  "i");
}
```

fails (in a2, a3).

--


More information about the Digitalmars-d-bugs mailing list