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

            Bug ID: 72580
           Summary: Cannot throw non movable object
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gleb at scylladb dot com
  Target Milestone: ---

This program fails to compile with "xx.cc:12:11: error: use of deleted function
‘E::E(E&&)’" error. It should use copy constructor instead.

struct E {
    int x;
    E(int x_) : x(x_) {}
    ~E() {}
    E(E&&) = delete;
    E(const E& o) : x(o.x) {}
    E& operator=(const E& o) { x = o.x; return *this; }
};

int main() {
    E ex(1);
    throw ex;
}

Reply via email to