mixin template Root() { this(int x) { } void test() { } } class Foo { mixin Root; this() { test(); // OK this(1); // FAIL } } void main() { } It's ok to add virtual methods but not constructors. This has to be a bug..
(In reply to comment #0) > mixin template Root() > { > this(int x) { } > void test() { } > } > > class Foo > { > mixin Root; > this() > { > test(); // OK > this(1); // FAIL > } > } > > void main() { } > > It's ok to add virtual methods but not constructors. This has to be a bug.. sadly, it's not a bug. template mixins create a scope and there's no overload resolution between it and it's enclosing scope. We should really have a way of doing a full mixin without resorting to strings.
*** Issue 9851 has been marked as a duplicate of this issue. ***
Indeed this is not technically a bug at all, for example: http://dlang.org/spec/template-mixin.html#mixin_scope *However*, we could make it a compiler error to define constructors in mixin templates as they can't really be used in any way.
*** This issue has been marked as a duplicate of issue 3332 ***