[Issue 14363] DMD should compile SDC test0165.d
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Mar 28 21:21:10 PDT 2015
https://issues.dlang.org/show_bug.cgi?id=14363
--- Comment #1 from Kenji Hara <k.hara.pg at 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);
}
--
More information about the Digitalmars-d-bugs
mailing list