[Issue 22869] New: Child class that doesn't implement an interface function allowed to be used
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Mar 11 09:39:20 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=22869
Issue ID: 22869
Summary: Child class that doesn't implement an interface
function allowed to be used
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: atila.neves at gmail.com
This code produces a crashing binary. The `Oops` class doesn't implement the
`accept` function, which is also not implemented in the base class either. This
shouldn't be allowed to compile, but currently does and crashes at runtime.
----------
class Visitor { }
interface Visitable {
void accept(Visitor) @safe;
}
abstract class Abstract : Visitable { }
class Oops : Abstract { }
void main() {
Abstract oops = new Oops;
scope visitor = new Visitor;
oops.accept(visitor);
}
----------
--
More information about the Digitalmars-d-bugs
mailing list