https://issues.dlang.org/show_bug.cgi?id=14363
--- Comment #1 from Kenji Hara <k.hara...@gmail.com> --- I'm not sure why SDC accepts the code. The following reduced case is correctly rejected by dmd, because ba.foo() won't work expectedly. Maybe SDC generates wrong code? void main() { uint x = 7; class A { auto foo() { return x; } } auto makeB(uint y) { class B : A { auto bar() { return foo() + y; } } return new B(5); } A a = new A(); assert(a.foo() == 7); auto b = makeB(3); assert(b.bar() == 10); A ba = b; assert(ba.foo() == 7); } --