diff --git a/CodeGenerator.cpp b/CodeGenerator.cpp index 1b7ddd2b..ee173105 100644 --- a/CodeGenerator.cpp +++ b/CodeGenerator.cpp @@ -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())); }); } diff --git a/tests/Issue236.cpp b/tests/Issue236.cpp new file mode 100644 index 00000000..9252eda6 --- /dev/null +++ b/tests/Issue236.cpp @@ -0,0 +1,2 @@ +struct S {}; +class T : virtual S {}; diff --git a/tests/Issue236.expect b/tests/Issue236.expect new file mode 100644 index 00000000..3d01f3c2 --- /dev/null +++ b/tests/Issue236.expect @@ -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; +}; + +