libstdc++: Define converting assignment operator for std::move_iterator
authorJonathan Wakely <jwakely@redhat.com>
Tue, 9 Jun 2020 21:16:24 +0000 (22:16 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 9 Jun 2020 21:16:24 +0000 (22:16 +0100)
commit733167f9d5ca5b9417559b7362d91e967be95a01
treee2d8662e0c24f771fa9c24436393bc09a9454b4e
parentd3647057913d3671312a79a77be02fc459d89fb6
libstdc++: Define converting assignment operator for std::move_iterator

As clarified by LWG 3265, std::move_iterator is supposed to have an
assignment operator that converts from a different specialization of
std::move_iterator, which performs an assignment. That has always been
missing from libstdc++, so assigning a different type actually performs
a converting construction, then an assignment. This is non-conforming
for the (fairly contrived) case where the converting assignment is
well-formed but the converting construction is not.

* include/bits/stl_iterator.h (move_iterator::operator=): Define.
* testsuite/24_iterators/move_iterator/dr3265.cc: New test.
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/testsuite/24_iterators/move_iterator/dr3265.cc [new file with mode: 0644]