C++ lvalue required as unary '&' operand
<p>I'm working on a game engine and working on implementing a state design. I have an Engine class which takes care of all the initialization of everything and contains the game loop which calls update, render and handle input functions of the active state.</p>

<p>All my different states inherit from State which requires a reference to the Engine class in its constructor, in order to initialize the protected reference of the engine for future use. Here's the relevant code:</p>

<pre><code>// file: state.h
class Engine;

class State {
public:

    State(Engine &amp;engine) : mEngine(engine) { }
protected:
    Engine &amp;mEngine;
};

// file: gamestate.h
class GameState : public State {
public:
    GameState(Engine &amp;engine) : State(engine) {}
};
</code></pre>

<p>and finally in engine.cpp in the initializer I create a new GameState object, which is where the error is reported.</p>

<pre><code>GameState *state = new GameState(&amp;this);
</code></pre>

<p>I'm coding it in C++ using Qt Creator on Linux at the minute, don't have access to a windows machine right now to see if it's a problem with the gcc or not.</p>
