mixin template and overloading

Luc Bourhis via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 20 03:30:38 PST 2015


Consider:

~ % dmd -v|head -n 1
DMD64 D Compiler v2.066-devel

~% cat mixin_template_pb.d
mixin template Foo(T) {
   void bar() {}
}

struct FooBar {
   mixin Foo!int;
   void bar(ulong d)() {}
}

void check() {
   FooBar o;
   o.bar();
}
~% dmd -c mixin_template_pb.d
mixin_template_pb.d(12): Error: template 
mixin_template_pb.FooBar.bar cannot deduce function from argument 
types !()(), candidates are:
mixin_template_pb.d(7):        mixin_template_pb.FooBar.bar(ulong 
d)()

It looks like the compiler does not see the mixed-in "bar". If I 
comment out the definition of "bar" in "FooBar", it compiles 
fine. Is this to be considered a bug?


More information about the Digitalmars-d mailing list