Template arguments produce unidentified identifier

Rufus Smith via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Jul 19 20:11:11 PDT 2016


On Wednesday, 20 July 2016 at 01:48:31 UTC, Adam D. Ruppe wrote:
> Take a read of this:
>
> http://stackoverflow.com/a/32621854/1457000
>
> The short of it is don't mixin stringof. Instead, mixin the 
> actual template itself.
>
> The functionLinkage might need to be string, but the types 
> should remain literal. So try this:
>
> mixin("alias Func = extern("~functionLinkage!Q~") 
> (ReturnType!Q) function (Erase!(Parameters!Q));");
>
>
> or something like that - don't concatenate strings of those, 
> just make the string itself still say ReturnType!Q etc when you 
> mix in. Then the scope will be correct.

Thanks, it did work with some modification:

mixin("alias Func = extern("~functionLinkage!Q~") ReturnType!Q 
function(Erase!(Parameters!Q));");

No parenthesis around ReturnType or strange errors happen.



More information about the Digitalmars-d-learn mailing list