]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Simplify noexcept-specifiers for move constructors
authorJonathan Wakely <jwakely@redhat.com>
Thu, 8 Apr 2021 15:29:11 +0000 (16:29 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Thu, 8 Apr 2021 16:49:59 +0000 (17:49 +0100)
commit1cbba49e3417d9b0661e70301d6fb7a7f52fd360
treecc43d05bb09fce4267b812c770fe6160b11113c7
parent59d09f9fe4bcf4a341494220be377dfe13d84c1e
libstdc++: Simplify noexcept-specifiers for move constructors

This puts the logic for the noexcept-specifier in one place, and then
reuses it elsewhere. This means checking whether the move constructor
can throw doesn't need to do overload resolution and then check whether
some other constructor can throw, we just get the answer directly.

libstdc++-v3/ChangeLog:

* include/bits/hashtable.h (_Hashtable::_S_nothrow_move()):
New function to determine noexcept-specifier for move
constructors.
(_Hashtable): Use _S_nothrow_move() on move constructors.
* testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc:
Correct static assertion message.
* testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc:
Likewise.
* testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc:
Likewise.
* testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc:
Likewise.
libstdc++-v3/include/bits/hashtable.h
libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc
libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc
libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc
libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc