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

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Aug 1 03:21:51 PDT 2016


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

--- Comment #2 from Jonathan M Davis <issues.dlang at jmdavisProg.com> ---
Yes, tupleof gives an AliasSeq of the fields in the struct - which is exactly
what I want. It would be a major problem if it did something else. Also, there
is no alias parameter here. It's a variadic template parameter, not an alias
parameter. And note that this code compiles just fine:

void main()
{
    auto result = foo!(S.tupleof);
}

struct S
{
    int i;
}

template foo(fields...)
{
    enum foo = true;
}

It's just that when foo is a templated function instead of an eponymous
template, you get the compilation error. So, something about foo being a
function makes the compiler choke.

--


More information about the Digitalmars-d-bugs mailing list