mardi 30 juin 2015

std::move in g++ 5.1

The following snippet fails to compile with g++ 5.1:

class C {
public:
    C(C &&other) {
        *this = std::move(other);
    }

    C& operator=(C &&other) { return *this; }
};

The error message is:

In constructor 'C::C(C&&)': 4:17: error: 'move' is not a member of 'std' 

I am definitely supplying the -std=c++11 flag. You can try this example yourself: http://cpp.sh/6cry

Am I missing something here? I've had code with std::move compile on this compiler before. This same code compiles fine with Visual Studio 2013's compiler.

Aucun commentaire:

Enregistrer un commentaire