Bug 13954 – (D1 only) Compiler allows implementing float return method with a real return type

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D1 (retired)
Platform
All
OS
All
Creation time
2015-01-08T14:17:00Z
Last change time
2016-05-13T22:57:43Z
Keywords
accepts-invalid, industry
Assigned to
nobody
Creator
andrej.mitrovich

Comments

Comment #0 by andrej.mitrovich — 2015-01-08T14:17:43Z
----- 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
Comment #1 by smjg — 2016-03-17T13:12:37Z
float, double and real are all floating point types.
Comment #2 by github-bugzilla — 2016-05-13T17:19:39Z
Commits pushed to dmd-1.x at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/8728fdd029d1f6765dd634fef2a7ed25b6539f4d Fix Issue 13954 - Disallow non-covariant overrides https://github.com/dlang/dmd/commit/2cce6488ade684c473316b3defa5f438bb4b0655 Merge pull request #5187 from AndrejMitrovic/fix-override [D1] Issue 13954 - Disallow non-covariant overrides
Comment #3 by bugzilla — 2016-05-13T17:30:29Z