[Issue 23240] New: dmd compiles 'ok' class invalid to interface if class contains abstract members
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 11 22:02:42 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23240
Issue ID: 23240
Summary: dmd compiles 'ok' class invalid to interface if class
contains abstract members
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: animuspexus at protonmail.com
following code compiles ok, but it shouldn't: interface doesn't match.
this bug doesn't work if there are no abstract member in class.
```D
import std.stdio;
interface ClassInterface
{
ClassInterface setValue(string val);
}
class ClassPrototype : ClassInterface
{
string value;
void setValue(string val)
{
value = val;
}
abstract void doSomething();
}
class Class : ClassPrototype
{
override void doSomething()
{
writeln("321");
}
}
void main()
{
auto inst = new Class();
inst.setValue("123");
}
```
--
More information about the Digitalmars-d-bugs
mailing list