Thread overview
[Issue 23240] dmd compiles 'ok' class invalid to interface if class contains abstract members
Jul 11, 2022
Alexey
Jul 11, 2022
Alexey
Jul 11, 2022
kinke
Jul 13, 2022
Alexey
July 11, 2022
https://issues.dlang.org/show_bug.cgi?id=23240

--- Comment #1 from Alexey <animuspexus@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");
}
```

--
July 11, 2022
https://issues.dlang.org/show_bug.cgi?id=23240

Alexey <animuspexus@protonmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid

--
July 11, 2022
https://issues.dlang.org/show_bug.cgi?id=23240

kinke <kinke@gmx.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |kinke@gmx.net
           Hardware|x86_64                      |All
                 OS|Linux                       |All
           Severity|normal                      |regression

--- Comment #2 from kinke <kinke@gmx.net> ---
This is a regression. According to run.dlang.io:

2.060-2.063:
onlineapp.d(12): Error: function onlineapp.ClassPrototype.setValue of type
void(string val) overrides but is not covariant with
onlineapp.ClassInterface.setValue of type ClassInterface(string val)

2.064-2.092:
onlineapp.d(20): Error: class `onlineapp.Class` interface function
`ClassInterface setValue(string val)` is not implemented

Wrongly compiles since v2.093.

--
July 13, 2022
https://issues.dlang.org/show_bug.cgi?id=23240

--- Comment #3 from Alexey <animuspexus@protonmail.com> ---
looks like this bug is related to those bugs

https://issues.dlang.org/show_bug.cgi?id=21321 https://issues.dlang.org/show_bug.cgi?id=21184

basically, I've simply searched by 'abstract word' and there are looks like more related  bugs.

--
December 13
https://issues.dlang.org/show_bug.cgi?id=23240

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/18117

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--