[Bug libstdc++/106239] vector::resize(size_type, const value_type&) should not require copy-assignability

dan.raviv at gmail dot com gcc-bugzilla@gcc.gnu.org
Sat Jul 9 17:03:05 GMT 2022


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106239

--- Comment #4 from Dan Raviv <dan.raviv at gmail dot com> ---
C does meet the CopyInsertible requirements:

https://godbolt.org/z/8j7KcbhdM

#include <memory>

class C {
    const int m_x;
public:
    C(int x) : m_x (x) {}
};

int main()
{
    // C is CopyInsertable:
    {
        alignas(C) char mem[sizeof(C)];
        auto v = C(42);
        C* c = ::new((void*)mem) C(v);
        c->~C();
    }
    {
        alignas(C) char mem[sizeof(C)];
        auto v = C(42);
        C* c = std::construct_at ((C*)mem, v);
        c->~C();
    }
}


More information about the Gcc-bugs mailing list