mercredi 22 juillet 2015

Autogenerated default move constructor with declared destructor

C++11 Standard specifies that auto generated move constructors should not be generated for classes declaring destructors, but the following code snippet builds and runs correctly:

#include <iostream>

class C
{
public:
    ~C() { std::cout << "Called C:~C" << std::endl; }

private:
    std::string v;
};


int main()
{
    C c1;
    C c2 = std::move(c1);

    return 0;
}

I can build with clang 4.2.1 and gcc 4.4.3. Am i missing something?

Aucun commentaire:

Enregistrer un commentaire