]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Make std::unique_lock self-move-assignable
authorJonathan Wakely <jwakely@redhat.com>
Thu, 6 Mar 2025 13:29:41 +0000 (13:29 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Thu, 6 Mar 2025 16:46:19 +0000 (16:46 +0000)
commit1ccbf8e2c2496779862a0153ed95459f72794521
treeb06093235ac7c91288f50e373ecf848be34444db
parent49ac89e03f2f171b401ac8b9d7c3cef72efbdc63
libstdc++: Make std::unique_lock self-move-assignable

LWG 4172 was approved in Hagenberg, February 2025, fixing
std::unique_lock and std::shared_lock to work correctly for
self-move-assignment.

Our std::shared_lock was already doing the right thing (contradicting
the standard) so just add a comment there. Our std::unique_lock needs to
be fixed to do the right thing.

libstdc++-v3/ChangeLog:

* include/bits/unique_lock.h (unique_lock::operator=): Fix for
self-move-assignment.
* include/std/shared_mutex (shared_lock::operator=): Add
comment.
* testsuite/30_threads/shared_lock/cons/lwg4172.cc: New test.
* testsuite/30_threads/unique_lock/cons/lwg4172.cc: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
libstdc++-v3/include/bits/unique_lock.h
libstdc++-v3/include/std/shared_mutex
libstdc++-v3/testsuite/30_threads/shared_lock/cons/lwg4172.cc [new file with mode: 0644]
libstdc++-v3/testsuite/30_threads/unique_lock/cons/lwg4172.cc [new file with mode: 0644]