https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117962
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-14 branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:3590d9f68207861b8973f2812adf02fdba0840ba commit r14-11183-g3590d9f68207861b8973f2812adf02fdba0840ba Author: Jonathan Wakely <jwak...@redhat.com> Date: Mon Dec 9 10:52:10 2024 +0000 libstdc++: Fix debug containers for constant evaluation [PR117962] Using a stateful allocator with std::vector would fail in Debug Mode, because the allocator-extended move constructor tries to swap all the attached safe iterators, but that uses a non-inline function which isn't constexpr. We don't actually need to swap any iterators in constant expressions, because we never attach them to the container in the first place. This bug went unnoticed because the tests for constexpr std::vector were using a stateful allocator with a std::allocator base class, but were failing to override the inherited is_always_equal trait from std::allocator. That meant that the allocators took the always-equal code paths, and didn't try to use the buggy constructor. In C++26 the std::allocator::is_always_equal trait goes away, and so the tests changed behaviour, revealing the bug. libstdc++-v3/ChangeLog: PR libstdc++/117962 * include/debug/safe_container.h: Make allocator-extended move constructor a no-op during constant evaluation. (cherry picked from commit 6fbe9e65645f54cc564a928bc0bc69c8b421cb98)