April 03, 2023
https://issues.dlang.org/show_bug.cgi?id=23819

          Issue ID: 23819
           Summary: defining your own interface IUnknown messes up vtable
                    without any warning
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: puremagic@zoadian.de

I've defined my own interface IUnknown, but IUnknown is somehow treated specially and leads to hidden bugs (in my case a defect vtable) where the compiler doesn't warn me that the calling convention is somehow changed to extern(Windows).



https://run.dlang.io/is/YuouXd

class Test : IUnknown {
    void test() {}
}

interface IUnknown {
    void test();
}

void main() {
    auto hm = new Test();
    hm.test();
}

vs

https://run.dlang.io/is/nxRwN0

class Test : IUnknown_x {
    void test() {}
}

interface IUnknown_x {
    void test();
}

void main() {
    auto hm = new Test();
    hm.test();
}

--