------- Comment #4 from michal at rzechonek dot net  2009-01-31 16:58 -------
I think that this bug is related to failure in code below:

class movable {
    int resource; // 0=not acquired
    movable(const movable&); // no copy c'tor
    void operator=(const movable&); // no copy-assignment
public:
    explicit movable(int i=0) : resource(i) {}
    int get() const {return resource;}
    int release() {int r=resource; resource=0; return r;}
    movable(movable && rval) : resource(rval.release())
    { cout << "movable::movable(movable &&)" << endl;}
};

void sink(movable m) {
    cout << "sink: &m --> " << &m << endl;
    cout << "sink: m.get() --> " << m.get() << endl;
}

int main() {
    movable m (42);
    cout << "main: &m --> " << &m << endl;
    sink(move(m));
    assert(m.get()==0);
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36744

Reply via email to