Skip to content

Commit

Permalink
Fix msvc compile with movable mocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
FranckRJ committed May 9, 2024
1 parent 26023da commit 66ee9cf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions include/mockutils/mscpp/VirtualTable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,7 @@ namespace fakeit {
}

protected:
static const unsigned int numOfCookies = 3;
static const unsigned int dtorCookieIndex = numOfCookies - 1; // use the last cookie
void **_firstMethod = nullptr;
void **_firstMethod;
};

template<class C, class... baseclasses>
Expand All @@ -190,7 +188,8 @@ namespace fakeit {
}

VirtualTable(const VirtualTable&) = delete;
VirtualTable(VirtualTable&& other) noexcept {
VirtualTable(VirtualTable&& other) noexcept
: VirtualTableBase(nullptr) {
std::swap(_firstMethod, other._firstMethod);
}

Expand Down Expand Up @@ -245,13 +244,15 @@ namespace fakeit {
}

private:

class SimpleType {
};

static_assert(sizeof(unsigned int (SimpleType::*)()) == sizeof(unsigned int (C::*)()),
"Can't mock a type with multiple inheritance or with non-polymorphic base class");

static const unsigned int numOfCookies = 3;
static const unsigned int dtorCookieIndex = numOfCookies - 1; // use the last cookie

static void **buildVTArray() {
int vtSize = VTUtils::getVTSize<C>();
auto array = new void *[vtSize + numOfCookies + 1]{};
Expand Down

0 comments on commit 66ee9cf

Please sign in to comment.