On Friday, 30 March 2018 at 13:56:45 UTC, Stefan Koch wrote:
On Friday, 30 March 2018 at 06:11:22 UTC, 9il wrote:
[1] https://issues.dlang.org/show_bug.cgi?id=16486


Ah that is an interesting bug which further demonstrates that templates are a tricky thing :) Basically you cannot _generally_ proof that one template just forwards to another.
Therefore you have to create separate types.
And since you create separate types the alias is not an alias but a separate template. Solving this may be possible for special cases but in the general case is infeasible.

What about something like this (using the reduced example from the bug report):

import std.traits : TemplateOf;

struct TestType(T) {}
alias TestAlias(T) = TestType!T;

template testFunction(T, alias U = TemplateOf!(TestAlias!T))
{
    void testFunction(U!T arg) {}
}

void main()
{
    TestAlias!int testObj;
    testFunction(testObj);
}

Reply via email to