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