[Bug libstdc++/121348] `vector::resize(n, value)` incorrectly requires the element type to be assignable
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Aug 2 21:04:36 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121348
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://eel.is/c++draft/vector.capacity
Preconditions: T is Cpp17CopyInsertable into vector.
https://eel.is/c++draft/container.alloc.reqmts#def:Cpp17CopyInsertable_into_X
T is Cpp17CopyInsertable into X means that, in addition to T being
Cpp17MoveInsertable into X, the following expression is well-formed:
allocator_traits<A>::construct(m, p, v)
and its evaluation causes the following postcondition to hold: The value of v
is unchanged and is equivalent to *p.
Looks like there was a change between C++14 and C++17 here though.
Because in C++14 (via issue 2033; https://cplusplus.github.io/LWG/issue2033),
It was "Requires: T shall be MoveInsertable into *this and CopyInsertable into
*this."
More information about the Gcc-bugs
mailing list