]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Fix minor bugs in std::common_iterator
authorJonathan Wakely <jwakely@redhat.com>
Wed, 20 Jul 2022 11:49:28 +0000 (12:49 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 20 Jul 2022 22:34:20 +0000 (23:34 +0100)
commit3b5567c3ec7e5759bdecc6a6fc0be2b65a93636e
treec8133dca1c61c878ed8f7850dde3a670cc604f6c
parent5e830693dd335621940368b6d39b23afc2c98545
libstdc++: Fix minor bugs in std::common_iterator

The noexcept-specifier for some std::common_iterator constructors was
incorrectly using an rvalue as the first argument of
std::is_nothrow_assignable_v. This gave the wrong answer for some types,
e.g. std::common_iterator<int*, S>, because an rvalue of scalar type
cannot be assigned to.

Also fix the friend declaration to use the same constraints as on the
definition of the class template. G++ fails to diagnose this error, due
to PR c++/96830.

Finally, the copy constructor was using std::move for its argument
in some cases, which should be removed.

libstdc++-v3/ChangeLog:

* include/bits/stl_iterator.h (common_iterator): Fix incorrect
uses of is_nothrow_assignable_v. Fix inconsistent constraints on
friend declaration. Do not move argument in copy constructor.
* testsuite/24_iterators/common_iterator/1.cc: Check for
noexcept constructibnle/assignable.
libstdc++-v3/include/bits/stl_iterator.h
libstdc++-v3/testsuite/24_iterators/common_iterator/1.cc
This page took 0.048572 seconds and 5 git commands to generate.