https://gcc.gnu.org/bugzilla/show_bug.cgi?id=121348
Bug ID: 121348 Summary: `vector::resize(n, value)` incorrectly requires the element type to be assignable Product: gcc Version: 14.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: iamsupermouse at mail dot ru Target Milestone: --- The following code doesn't compile, because `vector::resize(n, value)` for some reason tries to call the assignment operator of the element type: #include <vector> struct A { A() {} A(const A &) {} A &operator=(const A &) = delete; }; int main() { std::vector<A> v; v.resize(42, A{}); } This only happens with libstdc++, while libc++ and MSVC STL are happy with this. Tested on libstdc++ 15 and trunk. The single-argument `resize()` also works fine. The standard requires the element type to be Cpp17CopyInsertable for this method, and it seems that doesn't require assignability.