February 11, 2010 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. Tomek |
Copyright © 1999-2021 by the D Language Foundation