Thread overview
[Issue 9114] Can't call varadic template function with partly specified template parameters
Jun 01, 2016
Andrej Mitrovic
Jun 01, 2016
Andrej Mitrovic
Dec 17, 2022
Iain Buclaw
Feb 11, 2023
Basile-z
June 01, 2016
https://issues.dlang.org/show_bug.cgi?id=9114

Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com

--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
Workaround:

template test (int a)
{
    void test ( Args...) ( Args args ){}
}

void main ( char[][] arg)
{
    test!(5)(3);
}

--
June 01, 2016
https://issues.dlang.org/show_bug.cgi?id=9114

--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> ---
Here's another workaround, where you can simply declare an alias in your code via `alias FixedForward!(target_func) fixed_func` and use it regularly.

-----
import tango.core.Traits;

// the magic
template FixedForward ( alias func )
{
    struct FixedForward ( T )
    {
        static ReturnTypeOf!(func!(T)) opCall ( X ... ) ( X x )
        {
            return func!(T, X)(x);
        }
    }
}

// the target function you want to fix
T[] test ( T, Args...) ( Args args ) { return cast(T[])[args]; }

// just declare an alias of it
alias FixedForward!(test) FixedTest;

// works at ctfe
const static_result = FixedTest!(short)(1, 2, 3);

alias short[] ShortArray;

static assert(is(typeof(static_result == ShortArray)));
static assert(static_result == cast(short[])[1, 2, 3]);

void main ( char[][] arg)
{
    // works at rtfe
    auto result = FixedTest!(short)(1, 2, 3);

    static assert(is(typeof(result == ShortArray)));

    assert(result == cast(short[])[1, 2, 3]);
}
-----

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=9114

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--
February 11, 2023
https://issues.dlang.org/show_bug.cgi?id=9114

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp@gmx.com
         Resolution|---                         |WONTFIX

--