https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106812

Charles-Henri Gros <chgros at coverity dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |chgros at coverity dot com

--- Comment #4 from Charles-Henri Gros <chgros at coverity dot com> ---
It's worse than this, "throw" will even move a non-movable value in the absence
of a copy constructor:

#include <iostream>
#include <memory>

using namespace std;

int main(int argc, char const * const *argv)
{
    unique_ptr<int> u(new int);
    cout << "u.get() first: " << (void*)u.get() << endl;
    try {
        throw u;
    } catch(...) {
    }
    cout << "u.get() after throw: " << (void*)u.get() << endl;
}

Reply via email to