Bug 3526 – Mixin of member function not overriden by enclosing scope
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2009-11-19T10:22:00Z
Last change time
2015-06-09T01:27:05Z
Assigned to
nobody
Creator
tomeksowi
Comments
Comment #0 by tomeksowi — 2009-11-19T10:22:45Z
interface Foo {
public int foo();
}
template fooImpl() {
public override int foo() { return 4; }
}
class Goo : Foo {
mixin fooImpl!();
public override int foo() { return 7; }
}
void main() {
Foo f = new Goo;
assert (f.foo == 7);
}
The above assert fails. Problem is the declaration order matters -- when the mixin comes AFTER the hand-coded foo(), it's fine.