[Issue 14210] invalid merging of template instances
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Feb 20 19:15:50 PST 2015
https://issues.dlang.org/show_bug.cgi?id=14210
--- Comment #4 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Ketmar Dark from comment #3)
> this is CTFE wrapper generator, and with merging like now *each* registered
> delegate with the same parameter types will get the same default values.
> this kills the whole CTFE wrapper generation idea.
Unfortunately the code does not work as you expected. Default arguments won't
be encoded in type, so you cannot capture them via type.
Instead of that, you need to handle a function symbol.
void foo(alias f)()
{
import std.traits;
pragma(msg, ParameterDefaultValueTuple!f); // directly give a function
symbol
}
void main()
{
foo!((int a=40) => a+2); // tuple(40)
foo!((int a) => a+2); // (void)
}
--
More information about the Digitalmars-d-bugs
mailing list