Skip to content

Commit

Permalink
Is move ctor generated when copy ctor is explicitly defaulted?
Browse files Browse the repository at this point in the history
  • Loading branch information
XeCycle committed Apr 7, 2017
1 parent af32568 commit 2cc256e
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions explicit-default-copy-move.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <iostream>

struct M {
M() = default;
M(M const&) { std::cout << "copied\n"; }
M(M&&) { std::cout << "moved\n"; }
};

struct T {
M m;
T() = default;
T(T const&) = default;
};

int main()
{

T a;
T b(a);

return 0;
}

0 comments on commit 2cc256e

Please sign in to comment.