Error in template instantiation from D-Cookbook example
Adam D. Ruppe
destructionator at gmail.com
Fri Feb 9 21:39:22 UTC 2018
On Friday, 9 February 2018 at 21:31:29 UTC, ShadoLight wrote:
> [1] https://run.dlang.io/is/dyElXg
There's missing quotes in there:
Line 14:
code ~= "push(call!"~piece~"(pop(), pop()));\n";
Should be:
code ~= "push(call!\""~piece~"\"(pop(), pop()));\n";
That might have been an error in the original book. A lot of
quotes and semicolons got mangled in the process of copying them
from the actual compilable examples into the MS Word manuscript..
But to explain why this is wrong just consider the code generated:
push(call!+(pop(), pop()));
When the operator is pasted in without quotes, you get the above.
And + isn't a valid template arg. But "+" is.
More information about the Digitalmars-d-learn
mailing list