Function template argument deduction

Paul Backus snarwin at gmail.com
Sat Apr 7 14:37:29 UTC 2018


On Saturday, 7 April 2018 at 14:02:55 UTC, Paul Backus wrote:
> Interesting. Looks like this is an issue with aliases, because 
> I get the error with this code too:
>
> --- test.d
> import std.typecons: Tuple, tuple;
>
> alias Pair(T) = Tuple!(T, T);
>
> void foo(T)(Pair!T p)
> {
>     return;
> }
>
> unittest {
>     Pair!int x = tuple(1, 2);
>     foo(x);
> }
> ---

Looks like this is the same problem described in issue 1807:

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

I'm not sure what D was like when Martin Nowak made the most 
recent comment on that issue, in 2012, but alias templates do 
have their own dedicated language construct now, so maybe this is 
worth revisiting.


More information about the Digitalmars-d-learn mailing list