www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21271] New: C++ header generation ignores extern(D) class


          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
    // 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.

Sep 23 2020