chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
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);
    }
};
asked by kemaltaskin (600 points)

1 Answer

0 votes

Hello Kemal,

Can you provide me please the logs of the test run which reproduces the issue?

I've sent you a private mail so you could send me the logs in a more comfortable platform.

cheers,

Daniel Markov

Support Specialist.

answered by Daniel Markov (5.3k points)
Hi Daniel, I'm not sure if I can share the code. An update: this turned out to be a warning. It looked as if it was an error, due to our environment setup. It's still not nice of course but as long as I ignore the warning I can compile. Thank you.
Hello Kemal,

Thank you for the update,

We are happy it's not affecting on your development,

We will work on fixing this warning.

Best regards,

Daniel Markov.
...