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

            Bug ID: 93872
           Summary: std::move(first, last, out) doesn't work in -std=c++2a
                    when value type is move-only
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ppalka at gcc dot gnu.org
  Target Milestone: ---

$ cat bug.cc
#include <algorithm>
#include <array>

struct X
{
  X() = default;

  X(const X&) = delete;
  X& operator=(const X&) = delete;

  X(X&&) = default;
  X& operator=(X&&) = default;
};

bool
test01()
{
  std::array<X, 10> a, b;
  std::move(a.begin(), a.end(), b.begin());
  return true;
}
$ g++ -std=c++17 bug.cc
$ g++ -std=c++2a bug.cc
...
/home/patrick/code/gcc/libstdc++-v3/include/bits/stl_algobase.h:98:10: error:
use of deleted function ‘X& X::operator=(const X&)’
   98 |   *__dst = std::move(*__src);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~
bug.cc:9:6: note: declared here
    9 |   X& operator=(const X&) = delete;
      |      ^~~~~~~~
...

Reply via email to