[gcc r16-5883] libstdc++: Fix node-base containers copy and move constructor in debug mode.
Tomasz Kaminski
tkaminsk@gcc.gnu.org
Thu Dec 4 12:06:33 GMT 2025
https://gcc.gnu.org/g:83884812c5b8ed2ec70738e6d33f6e256ae1914d
commit r16-5883-g83884812c5b8ed2ec70738e6d33f6e256ae1914d
Author: Tomasz Kamiński <tkaminsk@redhat.com>
Date: Thu Dec 4 11:25:37 2025 +0100
libstdc++: Fix node-base containers copy and move constructor in debug mode.
The fixes regression from r16-5845-g8a2e6590cc4a2f that added an move
assignment operator to the _Safe_node_sequence, and made the class both
non move and copy constructible (copy is deleted, move is not declared).
In consequence debug version of node containers, that define they copy
and move as defaulted, and inherit from above, have deleted copy and moves.
libstdc++-v3/ChangeLog:
* include/debug/safe_sequence.h
(_Safe_node_sequence::_Safe_node_sequence): Define as defaulted.
Diff:
---
libstdc++-v3/include/debug/safe_sequence.h | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/libstdc++-v3/include/debug/safe_sequence.h b/libstdc++-v3/include/debug/safe_sequence.h
index c908d1e47a90..9120044052a3 100644
--- a/libstdc++-v3/include/debug/safe_sequence.h
+++ b/libstdc++-v3/include/debug/safe_sequence.h
@@ -136,14 +136,11 @@ namespace __gnu_debug
: public _Safe_sequence<_Sequence>
{
public:
- _GLIBCXX20_CONSTEXPR _Safe_node_sequence&
- operator=(const _Safe_node_sequence&) _GLIBCXX_NOEXCEPT
- {
- _M_invalidate_all();
- return *this;
- }
-
#if __cplusplus >= 201103L
+ _Safe_node_sequence() = default;
+ _Safe_node_sequence(_Safe_node_sequence&&) = default;
+ _Safe_node_sequence(_Safe_node_sequence const&) = default;
+
_GLIBCXX20_CONSTEXPR _Safe_node_sequence&
operator=(_Safe_node_sequence&& __x) noexcept
{
@@ -153,6 +150,13 @@ namespace __gnu_debug
}
#endif
+ _GLIBCXX20_CONSTEXPR _Safe_node_sequence&
+ operator=(const _Safe_node_sequence&) _GLIBCXX_NOEXCEPT
+ {
+ _M_invalidate_all();
+ return *this;
+ }
+
protected:
_GLIBCXX20_CONSTEXPR void
_M_invalidate_all() const
More information about the Libstdc++-cvs
mailing list