Ambiguous template parameter names

jmh530 john.michael.hall at gmail.com
Thu May 3 02:48:10 UTC 2018


On Thursday, 3 May 2018 at 00:52:58 UTC, Meta wrote:
> [snip]
>
> It's not a big per se. It's a consequence of the declaration 
> expanding to the real template function form (I can't type it 
> all out as I'm on my phone), thus the inner `val` from the 
> function shadows the one from the template.


That makes sense. Before creating the example, I would have 
assumed that when you instantiate it as foo!1, then the `val=1` 
would flow through to the inner foo function.

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



More information about the Digitalmars-d-learn mailing list