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.

Reply via email to