[Issue 6705] Bad codegen when passing fields as template alias params

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Nov 3 21:44:17 UTC 2019


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

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

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

--- Comment #2 from Basile-z <b2.temp at gmx.com> ---
this is a case where the global function (and non static) used as template
param becomes a (non-static) member.

But when the global func used as alias template parameter is explicitely
declared static this just works for example:


static int func(alias F)(int i)
{
    return i;
}

class C
{
    int a;
}

void main()
{
    auto a = &func!(C.a);
    assert(a(5) == 5);
    auto i = func!(C.a)(5);
}

I once tried to infer "static" but this broke the test suite... so people have
to put it by themselves even if it is weird to do so at the global scope.

--


More information about the Digitalmars-d-bugs mailing list