https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106239
Bug ID: 106239
Summary: vector::resize(size_type, const value_type&) should
not require copy-assignability
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: dan.raviv at gmail dot com
Target Milestone: ---
Copy-constructibility should be enough.
Related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83981
https://godbolt.org/z/a1sYxThxG
Compiles on Clang but not GCC:
#include <vector>
class C {
const int m_x;
public:
C(int x) : m_x (x) {}
};
int main()
{
auto v = std::vector<C>(10, C(42));
// v.resize(11); // Correctly does not compile
v.resize(11, C(42)); // Incorrectly does not compile on GCC
}