#include <iostream>
#include <iomanip>

using namespace std;

class Test {
public:
    Test()             { cout << "Test()\n"; }
    Test(int x):val_(x){ cout << "Test(" << x << ")\n"; }
    Test(const Test& t):val_(t.val_) { cout << "Test(const Test& " << t.val_ << ")\n"; }
    Test(Test&&t)      :val_(t.val_) { cout << "Test(const Test&& " << t.val_ << ")\n"; t.val_ = 0; }
    Test& operator = (const Test& t)  {
        cout << "Test& operator = (const Test& " << t.val_ <<")\n";
        val_ = t.val_;
        return *this;}
    Test& operator = (Test&& t) {
        cout << "Test& operator = (const Test&&" << t.val_ <<")\n";
        val_ = t.val_; t.val_ = 0;
        return *this;}
    ~Test()           { cout << "~Test(" << val_ <<")\n"; }
    int val() const { return val_; }
private:
    int val_ = 0;
};

struct Quest
{
    Test t;
    Quest(Test&& t):t(t){}
};

struct Qwest
{
    Test t;
    Qwest(Test&& t):t(move(t)){}
};

int main(int argc, const char * argv[])
{
    Test t(5), s(6);
    Quest q(move(t));
    Qwest w(move(s));
}
