Warning on template parameter identifier shadowing?

Paul Backus snarwin at gmail.com
Wed Aug 5 16:10:46 UTC 2020


On Wednesday, 5 August 2020 at 11:12:53 UTC, Johan wrote:
> What do you think about adding a warning about shadowing of an 
> outer template parameter by an inner template parameter name?
>
> cheers,
>   Johan

Not a fan. There are cases where I've done this 
intentionally--not with eponymous template members, but with 
private helper templates:

template foo(T) {
     enum helper(T) = ...; // error?
     void foo(T i) {
         static if (helper!T) ...;
         else ...;
     }
}


More information about the Digitalmars-d mailing list