Skip to content

Commit 577d291

Browse files
committed
Fixed missing vtable assignment in user provided constructor.
1 parent fca6fb6 commit 577d291

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

CfrontCodeGenerator.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,13 @@ void CfrontCodeGenerator::InsertCXXMethodDecl(const CXXMethodDecl* stmt, SkipBod
626626
bodyStmts.AddBodyStmts(
627627
Call(GetSpecialMemberName(stmt, GetRecordDeclType(ctorType->getAsRecordDecl())), callParams));
628628
}
629+
630+
// insert our vtable pointer
631+
InsertVtblPtr(stmt, stmt->getParent(), bodyStmts);
632+
// in case of multi inheritance insert additional vtable pointers
633+
for(const auto& base : parent->bases()) {
634+
InsertVtblPtr(stmt, base.getType()->getAsCXXRecordDecl(), bodyStmts);
635+
}
629636
}
630637

631638
if(body) {

0 commit comments

Comments
 (0)