digitalmars.D.bugs - [Issue 13954] New: (D1 only) Compiler allows implementing floating
- via Digitalmars-d-bugs (36/36) Jan 08 2015 https://issues.dlang.org/show_bug.cgi?id=13954
https://issues.dlang.org/show_bug.cgi?id=13954 Issue ID: 13954 Summary: (D1 only) Compiler allows implementing floating point return method with a real return type Product: D Version: D1 Hardware: x86_64 OS: Linux Status: NEW Keywords: industry Severity: normal Priority: P1 Component: DMD Assignee: nobody puremagic.com Reporter: andrej.mitrovich gmail.com ----- class A { abstract public float get(); } class C : A { public real get() { return 0; } } void main ( ) { A a = new C; assert(a.get() == 0); } ----- This assertion fails. Note that the above should not compile. The equivalent D2 code is caught at compile-time: test.d(15): Error: cannot create instance of abstract class C test.d(15): function 'float get()' is not implemented --
Jan 08 2015