Ambiguous template parameter names

jmh530 john.michael.hall at gmail.com
Fri May 4 16:05:40 UTC 2018


On Thursday, 3 May 2018 at 13:30:03 UTC, bauss wrote:
> On Thursday, 3 May 2018 at 02:51:18 UTC, Meta wrote:
>>
>> If you want that, you might be able to do `int val = val` on 
>> the inner function, though I'm not sure that'll work.
>
> It does not work and will do nothing.

Below compiles, but my guess is that the ASM is saying that the 
foo function only has a run-time argument.

template foo(int val)
{
     int foo(int val = val)
     {
         return val;
     }
}

void main()
{
     assert(foo!1 == 1);
     assert(foo!1(2) == 2);
}


More information about the Digitalmars-d-learn mailing list