[Issue 16093] Trivial case of passing a template function to another template function doesn't compile

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon May 30 06:23:09 PDT 2016


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

Max Samukha <maxsamukha at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |critical

--- Comment #3 from Max Samukha <maxsamukha at gmail.com> ---
Raising severity because I've been unable to find an acceptable workaround.

To make the absurdity of the current situation more obvious, it is possible to
access a local template function if it is wrapped in a struct:

void bar(alias f)() {
    f._f!(1, 2)();
}

void main() {
    int y;

    void f(A...)() {
        y = A[0] + A[1];
    }

    struct S {
       alias _f = f;
    }

    S s;
    bar!s();
    assert(y == 3); // ok
}

This bug might be a regression as well because I am almost sure I didn't have
this problem a couple of years ago.

--


More information about the Digitalmars-d-bugs mailing list