[Issue 16343] Incorrectly requiring this pointer for a free function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 20 11:41:34 UTC 2019


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

Basile-z <b2.temp at gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |b2.temp at gmx.com

--- Comment #6 from Basile-z <b2.temp at gmx.com> ---
In a way the message about "this" is not bogus. It has not been mentioned but
if you set func "static" then the code works.

===
struct S
{
    int i;
}

void main()
{
    foreach(memberName; __traits(allMembers, S))
        func!(__traits(getMember, S, memberName));
}

static void func(alias member)()
{
    auto protection = __traits(getProtection, member);
    alias Type = typeof(member);
    auto name = __traits(identifier, member);
}
===

The real bug is that "func" seems to be injected in "S" (or considered as
member of) for some reasons.

--


More information about the Digitalmars-d-bugs mailing list