C++ vector::push_back C1001 Internal compiler error

I am playing a little bit with C++ and SDL2 on Visual Studio 2013.
All worked fine until this line of code:

Obstacle o = Obstacle(Vector2f(SCENE_WIDTH, 0), Vector2f(1, 1));
**obstacles1->push_back(o);**

If I comment out the push_back line all work fine.
Now come the crazy thing.
If I remove all virtual modifiers from the Obstacle class the push_back function works and the error is not thrown.

With this the error is thrown:

class Obstacle : public Rectangle
{
public:
    Obstacle(const Vector2f& position, const Vector2f& size);
    Obstacle();
    virtual ~Obstacle();
public:
    virtual void update(float dt);
    virtual void render() const;
};

And with this it works fine:

class Obstacle : public Rectangle
{
public:
    Obstacle(const Vector2f& position, const Vector2f& size);
    Obstacle();
    ~Obstacle();
public:
    void update(float dt);
    void render() const;
};

How to fix it, so I can make my obstacle have virtual functions ?

EDIT:
If I make a function or destructor virtual in the Rectangle class I get the error, too.


Source: c++

Leave a Reply