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

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Rejecting this example is a new regression because r271158 moved the
move-assignment effects into __uniq_ptr_impl, so they are now triggered by
unique_ptr::swap.

But there's also an older regression introduced in gcc 7.1 which makes it
impossible to swap deleters that aren't move-assignable, such as:

  struct Deleter
  {
    Deleter& operator=(const Deleter&) = delete;

    void operator()(int* p) const noexcept { delete p; }

    // found by ADL
    friend void swap(Deleter& lhs, Deleter& rhs) noexcept
    { std::swap(lhs.id, rhs.id); }

    int id;
  };

Using std::swap to swap the tuple<pointer, deleter_type> means we fail to find
the deleter's ADL swap, and so can't swap unique_ptr<int, Deleter> objects.

Reply via email to