https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117962
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |redi at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed| |2024-12-09 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Actually I think we can just do this: --- a/libstdc++-v3/include/debug/safe_container.h +++ b/libstdc++-v3/include/debug/safe_container.h @@ -64,10 +64,13 @@ namespace __gnu_debug _Safe_container(_Safe_container&& __x, const _Alloc& __a, std::false_type) : _Safe_container() { - if (__x._M_cont().get_allocator() == __a) - _Base::_M_swap(__x); - else if (!std::__is_constant_evaluated()) - __x._M_invalidate_all(); + if (!std::__is_constant_evaluated()) + { + if (__x._M_cont().get_allocator() == __a) + _Base::_M_swap(__x); + else + __x._M_invalidate_all(); + } } protected: _Base::_M_swap just swaps all the safe iterators that are attached to the two containers, but we never attach iterators to containers in debug mode, so there's nothing to swap.