[Issue 21271] New: C++ header generation ignores extern(D) class methods affecting vtable layout

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 23 11:52:26 UTC 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 at puremagic.com
          Reporter: kinke at 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.

--


More information about the Digitalmars-d-bugs mailing list