www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - anonymous delegates and templates

[DMD 0.106]

Looks like anonymous delegates are always type of first template  
instantiation:

dgbug.d(11): function dgbug.A!(C ).A.foo (void delegate(C )d) does not  
match argument types (void delegate(B ))
dgbug.d(11): cannot implicitly convert expression __funclit1 of type void  
delegate(B ) to void delegate(C )

<dgbug.d>
class A(T)
{
   void foo(void delegate (T) d) {}

   void bar()
   {
     foo(delegate void (T t) {});
   }
}

class B: A!(B) {}

class C: A!(C) {}

void main()
{
}
Nov 21 2004