On 03/17/2013 05:36 PM, simendsjo wrote:
On Sunday, 17 March 2013 at 16:21:25 UTC, Timon Gehr wrote:
On 03/17/2013 05:15 PM, simendsjo wrote:
On Sunday, 17 March 2013 at 15:45:54 UTC, Timon Gehr wrote:
On 03/17/2013 01:54 PM, simendsjo wrote:
I get a lot of these errors, and they can be quite tricky to get
around
and hurts my API.. Is this a temporary restriction in DMD, or is it
another reason why this doesn't work?

Error: template instance template!local cannot use local 'local' as
parameter to non-global template innerTemplate(alias T)

http://d.puremagic.com/issues/show_bug.cgi?id=5710

Looks like the same issue. For me the use-case was a bit different
though..
I want to access struct members at CT only to look for UDAs, it's
type etc.
It works with workarounds, but the code gets ugly, and much convenience
is lost..

Too bad it looks like a wont-fix.

It is not a wont-fix, and it actually should work.

All the talk there looks to be around delegates. Would the same fix work
for my struct members?

Of course. It is exactly the same issue. In D, if any kind of local symbol is passed to a templated function, the templated function requires a context pointer to access the local symbol. Non-static member functions require a 'this' reference.

Only one additional implicit pointer can be passed to a non-static member function at a time, since every member function must be able to provide delegates. Therefore, there must be an additional indirection somewhere. (Eg. pass the 'this' pointer as a local variable inside the delegate context.)

Reply via email to