www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23240] New: dmd compiles 'ok' class invalid to interface if

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 puremagic.com
          Reporter: animuspexus 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");
}

```

--
Jul 11 2022