I am using a similar code based on the following example:
class FOO
{
private:
operator int() const;
};
class BARMOCK
{
public:
MOCK_METHOD1(Bar, void(const FOO& foo));
};
Unfortunately the following error message is generated by the compiler:
gtest/internal/gtest-internal.h(892): error C2248: 'FOO::operator int': cannot access private member declared in class 'FOO'
which comes from gtest-internal itself:
static const bool value = sizeof(Helper(ImplicitlyConvertible::MakeFrom())) == 1;
Is there any possible way to make it work, or is it a known limitation of the google mock framework?
Of course there are ways to workaround the problem, like:
class BARMOCK
{
public:
MOCK_METHOD1(BarMock, void());
void Bar(const FOO& foo) { BarMock(); }
};
But this is just a workaround, not a real solution. Does anyone know anything about this? Thanks.