#include <fakeit.hpp>
class Sample {
public:
virtual ~Sample() = default;
};
int main()
{
fakeit::Mock<Sample> mock;
mock.Reset();
}
with gcc-8.4.8 or gcc-9.0.1 like this
g++ -Wall -Wextra -Werror -std=c++17 a.cpp
produces quite ugly warnings:
In file included from a.cpp:1:
fakeit.hpp: In instantiation of ‘static unsigned int fakeit::VTUtils::getOffset(R (C::*)(arglist ...)) [with C = fakeit::VTUtils::getVTSize() [with C = Sample]::Derrived; R = void; arglist = {}]’:
fakeit.hpp:5311:44: required from ‘static unsigned int fakeit::VTUtils::getVTSize() [with C = Sample]’
fakeit.hpp:5977:54: required from ‘void fakeit::DynamicProxy<C, baseclasses>::Reset() [with C = Sample; baseclasses = {}]’
fakeit.hpp:7929:13: required from ‘void fakeit::MockImpl<C, baseclasses>::reset() [with C = Sample; baseclasses = {}]’
fakeit.hpp:8259:13: required from ‘void fakeit::Mock<C, baseclasses>::Reset() [with C = Sample; baseclasses = {}]’
a.cpp:12:16: required from here
fakeit.hpp:5273:28: error: cast between incompatible pointer to member types from ‘void (fakeit::VTUtils::getVTSize() [with C = Sample]::Derrived::*)()’ to ‘unsigned int (fakeit::VirtualOffsetSelector::*)(int)’ [-Werror=cast-function-type]
5273 | auto sMethod = reinterpret_cast<unsigned int (VirtualOffsetSelector::*)(int)>(vMethod);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I have not been able to figure out cause or remedy yet.
Hi,
Compiling this minimal program
with gcc-8.4.8 or gcc-9.0.1 like this
produces quite ugly warnings:
I have not been able to figure out cause or remedy yet.
Best,
Roland