DMD 0.149 release

Sean Kelly sean at f4.ca
Tue Mar 7 16:53:26 PST 2006


Tom S wrote:
> Walter Bright wrote:
>> The implicit function template instantiation is a bit limited at the 
>> moment, deduction won't work for types derived from templates, and the 
>> mechanism to pick the most specialized template doesn't work.
> 
> Does the fact that implicit instantiation doesn't work when the template 
> is a member of a class also belong to the 'limitation' category ? The 
> error messages are quite misleading: "Foo.bar is not a declaration" and 
> "template moduleName.Foo.bar(T) templates don't have properties" if Foo 
> is a struct instead.

I think the feature is just mostly unfinished--I get get very simple 
cases to work, but that's it.  For example, in the code below, templA 
works just fine, but the slightly fancier templB is not accepted:

C:\code\d>type test.d
import std.c.stdio;

template templA( Type )
{
     void templA( Type val )
     {
         printf( "%.*s\n", typeid(Type).classinfo.name );
     }
}

template templB( Type )
{
     void templB( Type[] val1, Type val2 )
     {
         printf( "%.*s\n", typeid(Type).classinfo.name );
     }
}

void main()
{
     templA( "blah" );
     templB( "blah", 'b' );
}

C:\code\d>dmd test.d
test.d(22): template test.templB(Type) does not match any template 
declaration
test.d(22): template test.templB(Type) cannot deduce template function 
from argument types (char[4],char)

C:\code\d>



More information about the Digitalmars-d-announce mailing list