www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Mixin bug: argument types

reply Hauke Duden <H.NS.Duden gmx.net> writes:
The following code does not compile (neither with DMD 0.90 nor with 0.91).


template FooDefaults()
{
	void foo(int i)
	{
		return foo(i,0);
	}	
}


class Foo
{
	mixin FooDefaults;
	
	void foo(int i,int j)
	{
	}
}


The error message is:

mixinbug.d(5): function foo (int i) does not match argument types (int,int)
mixinbug.d(5): Error: expected 1 arguments, not 2


I believe this is a compiler bug.



Hauke
May 29 2004
parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
Hauke Duden wrote:

 The following code does not compile (neither with DMD 0.90 nor with 
 0.91).


 template FooDefaults()
 {
     void foo(int i)
     {
         return foo(i,0);
     }   
 }


 class Foo
 {
     mixin FooDefaults;
     
     void foo(int i,int j)
     {
     }
 }


 The error message is:

 mixinbug.d(5): function foo (int i) does not match argument types 
 (int,int)
 mixinbug.d(5): Error: expected 1 arguments, not 2


 I believe this is a compiler bug.



 Hauke

You need to tell it which foo. This is using the same rules as import. template FooDefaults() { void foo(int i) { return this.foo(i,0); } } class Foo { mixin FooDefaults; void foo(int i,int j) { } } -- -Anderson: http://badmama.com.au/~anderson/
May 29 2004
parent Hauke Duden <H.NS.Duden gmx.net> writes:
Thanks, this helped (somewhat). I still have problems getting this to 
work in my realworld code, but I suspect it is really an issue with the 
language design, so I'll post about it to the D.d group.

J Anderson wrote:
 Hauke Duden wrote:
 
 The following code does not compile (neither with DMD 0.90 nor with 
 0.91).


 template FooDefaults()
 {
     void foo(int i)
     {
         return foo(i,0);
     }   }


 class Foo
 {
     mixin FooDefaults;
         void foo(int i,int j)
     {
     }
 }


 The error message is:

 mixinbug.d(5): function foo (int i) does not match argument types 
 (int,int)
 mixinbug.d(5): Error: expected 1 arguments, not 2


 I believe this is a compiler bug.



 Hauke

You need to tell it which foo. This is using the same rules as import. template FooDefaults() { void foo(int i) { return this.foo(i,0); } } class Foo { mixin FooDefaults; void foo(int i,int j) { } }

May 29 2004