[Issue 23240] 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:12:51 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23240
--- Comment #1 from Alexey <animuspexus at protonmail.com> ---
also, the following modification to the code compiles ok and resulting program
segfaults on run
```
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");
ClassInterface zzz = cast(ClassInterface) inst;
assert(zzz);
auto xxx = zzz.setValue("333");
}
```
--
More information about the Digitalmars-d-bugs
mailing list