www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Alias parameters in nested templates

I've been playing with templates recently and there's something I don't  
quite get.

template Outer() {
     template Inner(alias param) {
         alias param Inner;

void main() {
     long d;
     Outer!().Inner!(d) = 4; // fails

Error: template instance cannot use local 'd' as parameter to non-global  
template Inner(alias param)

Why is it OK to pass aliases to local variables to a normal (global)  
template, and not OK to a nested one? I'd appreciate a counter-example of  
sth bad happening in the forbidden case.

Feb 11 2010