[Issue 21298] New: Missing error when overriding interface method without in contract with class method with contract
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 8 10:52:06 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=21298
Issue ID: 21298
Summary: Missing error when overriding interface method without
in contract with class method with contract
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: minor
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: default_357-line at yahoo.de
Consider the following code:
```
interface I
{
void foo(int i);
}
class C : I
{
override void foo(int i) in (i > 0) { }
}
```
If `I` was a class, the compiler would rightly inform us that "function C.foo
cannot have an in contract when overridden function I.foo does not have an in
contract". However, since I is an interface, this error doesn't trigger. But it
should, of course, for the same reason.
--
More information about the Digitalmars-d-bugs
mailing list