September 23, 2020
https://issues.dlang.org/show_bug.cgi?id=21271

          Issue ID: 21271
           Summary: C++ header generation ignores extern(D) class methods
                    affecting vtable layout
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: kinke@gmx.net

Leading to a corrupt C++ vtable, e.g.:

extern(C++) class C
{
    extern(D) void virtualFoo1() {}
    void virtualFoo2() {}
}

dmd -HC ... =>

class C
{
public:
    // ignoring extern () block because of linkage
    virtual void virtualFoo2();
};

Overridden virtual functions can probably be still ignored, but new virtual functions need a dummy declaration on the C++ side.

--