Am 07.02.2013 13:45, schrieb Matej Nanut:

That's too bad. I was hoping to combine this with UDAs, for example, and I'm fairly sure you need
the aliased symbol for that.

Do you perhaps know what exactly the problem is? Is this going to be implemented in DMD or is it a
design issue so it can't work?

As far as I understood it's "only" an implementation problem: DMD works with a single context
pointer. Normally this will be this or a local delegate context pointer. But when a template is
defined inside of a function/class(*) and then a local variable is passed to it, it would need two
context pointers, one for the class/function scope (the template's scope) and one for the scope
where the variable lives in.

Originally the compiler accepted the code and silently failed by generating invalid code (causing
data corruption or linker errors). Instead of fixing/extending the compiler they chose to disallow
passing locals to local templates all together.

Passing local variables as aliases to global templates is still allowed, but it still can cause data
corruption. So I recommend to avoid that, too. I'll have to prepare a test case for this when I have
some time, as there currently is no open bug report for this AFAIK.

(*) All code in a Diet template is inserted into a function body as a technical necessity.