Actually I better report this, it might lead to unexpected behavior
otherwise. See, this will compile:
import std.stdio;
auto template_func(alias func, T...)(T args)
{
return func.mangleof;
}
void test() {}
unittest
{
writeln(template_func!(test, int)(1));
}
void main() { }
And this won't:
import std.stdio;
auto template_func(alias func, T...)(T args)
{
return func.mangleof;
}
void test(int x) {}
unittest
{
writeln(template_func!(test, int)(1));
}
void main() { }
(I've added a parameter to test()). The problem is the first code actually
called func, and succeeded silently since it takes no parameters. I don't
think this is an expected behavior?
On Sat, Aug 7, 2010 at 3:10 AM, Andrej Mitrovic
<[email protected]>wrote:
>
>
> On Fri, Aug 6, 2010 at 8:40 PM, Jonathan M Davis <[email protected]>wrote:
>
>> On Friday, August 06, 2010 08:08:03 Andrej Mitrovic wrote:
>> > I've already tried that. But .mangleof on an aliased symbol just returns
>> > "alias" as a string.
>>
>> That sounds like a bug report in the making.
>>
>> - Jonathan M Davis
>>
>
> No I was wrong, it won't allow me to use .mangleof on an alias of a
> function inside a template because that automatically calls the function
> (and that means I have to pass valid arguments to it). The mangledName!()
> template works just fine though. But I don't need mangled names, I was only
> using it as a workaround.
>