digitalmars.D.bugs - Mixin bug: argument types
- Hauke Duden (21/21) May 29 2004 The following code does not compile (neither with DMD 0.90 nor with 0.91...
- J Anderson (19/42) May 29 2004 You need to tell it which foo. This is using the same rules as import.
- Hauke Duden (4/59) May 29 2004 Thanks, this helped (somewhat). I still have problems getting this to
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
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. HaukeYou 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
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. HaukeYou 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