use delegate with IUnknown
Long Chang
changlon at gmail.com
Mon Oct 20 03:53:39 PDT 2008
I compile this code got error....
1. interface IUnknown{}
2. class klass : IUnknown{
3. this(){}
4. void add(void delegate() dg){}
5. }
6. void main(){
7. auto t = new klass;
8. t.add(delegate void(){});
9. }
t2.d(8): function t2.klass.add (void delegate()) does not match parameter types (void delegate())
t2.d(8): Error: cannot implicitly convert expression (__dgliteral1) of type void delegate() to void delegate()
this code work fine.
1. interface IUnknown_{}
2. class klass : IUnknown_{
3. this(){}
4. void add(void delegate() dg){}
5. }
6. void main(){
7. auto t = new klass;
8. t.add(delegate void(){});
9. }
Is this a bug?
More information about the Digitalmars-d
mailing list