Skip to content

Commit

Permalink
Fixed #236: Add missing virtual specifier for virtual inheritance.
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasfertig committed Sep 29, 2019
1 parent 232f317 commit 7f257e9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2370,7 +2370,10 @@ void CodeGenerator::InsertArg(const CXXRecordDecl* stmt)
mOutputFormatHelper.Append(" : ");

ForEachArg(stmt->bases(), [&](const auto& base) {
mOutputFormatHelper.Append(AccessToString(base.getAccessSpecifier()), " ", GetName(base.getType()));
const std::string virtualKw{base.isVirtual() ? kwVirtualSpace : ""};

mOutputFormatHelper.Append(
AccessToString(base.getAccessSpecifier()), " ", virtualKw, GetName(base.getType()));
});
}

Expand Down
2 changes: 2 additions & 0 deletions tests/Issue236.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
struct S {};
class T : virtual S {};
17 changes: 17 additions & 0 deletions tests/Issue236.expect
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
struct S
{
// inline constexpr S & operator=(const S &) = default;
// inline constexpr S & operator=(S &&) = default;
// inline ~S() = default;
};


class T : private virtual S
{
public:
// inline T & operator=(const T &) = default;
// inline T & operator=(T &&) = default;
// inline ~T() = default;
};


0 comments on commit 7f257e9

Please sign in to comment.