[Bug libstdc++/108820] New: vector::resize(n, v) requires copy_assignable, which is not part of the CopyInsertable concept
marc.mutz at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Feb 16 12:25:43 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108820
Bug ID: 108820
Summary: vector::resize(n, v) requires copy_assignable, which
is not part of the CopyInsertable concept
Product: gcc
Version: 13.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: marc.mutz at hotmail dot com
Target Milestone: ---
The following should work (and does, on MCVS and libc++), because S is
copy_constructible, just not copy_assignable. In particular, S is
CopyInsertable:
// https://godbolt.org/z/61ffqMj8n
#include <vector>
struct S { const int n; };
static_assert(std::is_copy_constructible_v<S>);
static_assert(std::is_nothrow_move_constructible_v<S>);
void test(std::vector<S> &v)
{
v.resize(15, S{42});
}
The libstdc++ implementation tries to instantiate the copy-assignment operator,
though.
More information about the Gcc-bugs
mailing list