Template Instantiation Bug

Jonathan Marler via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 4 08:01:30 PST 2014


In the past I don't get much response when I file a bug in 
BugZilla so I wanted to see if anyone could tell me anything 
about this issue in the forums.

I believe a bug has already been created here: 
https://issues.dlang.org/show_bug.cgi?id=2372

Here's the code to reproduce it:
--------------------------------------
import std.stdio;

template Transform(T)
{
   alias Transform = T;
}
void testTransform(T)(Transform!T t)
{
}
void testNoTransform(T)(T t)
{
}
void main(string[] args)
{
   testTransform(3);     // FAILS "cannot deduce function..."
   testTransform!int(3);

   testNoTransform(3);
   testNoTransform!int(3);
}
--------------------------------------

The test(3) line fails with this error message:

main.d(15): Error: template main.testTransform cannot deduce 
function from argument types !()(int), candidates are:
main.d(7):        main.testTransform(T)(Transform!T t)

Does anyone know anything about this, maybe this is "as 
designed"?  Thanks in advance for the info.


More information about the Digitalmars-d mailing list