DIP 1023--Resolution of Template Alias Formal Parameters in Template Functions--Community Review Round 1

Stefanos Baziotis sdi1600105 at di.uoa.gr
Wed Sep 11 01:39:22 UTC 2019


On Wednesday, 11 September 2019 at 00:35:26 UTC, jmh530 wrote:
> On Tuesday, 10 September 2019 at 21:48:33 UTC, Stefanos 
> Baziotis wrote:
>> [snip]
>
> Here is a simpler example:
>
> import std.traits : isNumeric;
>
> template Foo(T)
>     if (isNumeric!T)
> {
>     alias Foo = T;
> }
>
> void useFoo(T)(Foo!T x) {
>
> }
>
> void main() {
>     int x;
>     useFoo!int(x);
>     useFoo(x); //error currently, will it compile with this DIP?
> }

Thanks, that is clearer. And I understand the reasoning now.
Yes, it should. As far as I can tell, the draft
PR had a more complicated test case / example than this.
You can check it here [1]

[1] 
https://github.com/dlang/dmd/pull/9778/files#diff-f1fd9ecb820a6d8a95c2ba9675ce5071R34



More information about the Digitalmars-d mailing list