Bug 21271 – C++ header generation ignores extern(D) class methods affecting vtable layout
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2020-09-23T11:52:26Z
Last change time
2020-10-18T15:54:43Z
Keywords
pull
Assigned to
No Owner
Creator
kinke
Comments
Comment #0 by kinke — 2020-09-23T11:52:26Z
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.
Comment #1 by dlang-bot — 2020-10-18T15:11:12Z
@MoonlightSentinel updated dlang/dmd pull request #11872 "dtoh: Emit placeholders for skipped virtual functions" fixing this issue:
- Fix 21271: Emit placeholders for skipped virtual functions (dtoh)
This ensures proper vtable layout for classes which
have extern(D) functions
https://github.com/dlang/dmd/pull/11872
Comment #2 by dlang-bot — 2020-10-18T15:54:43Z
dlang/dmd pull request #11872 "dtoh: Emit placeholders for skipped virtual functions" was merged into master:
- 2e9015871a058a0b16ace6bc9e285d3de4027b46 by MoonlightSentinel:
Fix 21271: Emit placeholders for skipped virtual functions (dtoh)
This ensures proper vtable layout for classes which
have extern(D) functions
https://github.com/dlang/dmd/pull/11872