When I simply try to use this function from the documentation I cannot compile the code. It shows the error like this:
error: taking the address of a temporary object of type '::Typemock::ControlAction'
IsolatorInternals.h:1828:29: note: expanded from macro 'DoStaticOrGlobalInstead'
I use Windows 10, Qt Creator autotests, CppUnit, Qt 5.15.6.
Here is the code snippet:
class MyClass
{
public:
SomeClass* MyMethod()
{
return new SomeClass("test1");
}
};
class TestClass
{
private:
static SomeClass* FakeMyMethod()
{
return new SomeClass("test2");
}
void MyTestFunction()
{
MyClass* fake_class = FAKE<MyClass>();
// the following line causes the build to fail:
// error: taking the address of a temporary object of type '::Typemock::ControlAction'
// IsolatorInternals.h:1828:29: note: expanded from macro 'DoStaticOrGlobalInstead'
WHEN_CALLED(fake_class->MyMethod()).DoStaticOrGlobalInstead(FakeMyMethod, NULL);
}
};