public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "marc.mutz at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/108820] New: vector::resize(n, v) requires copy_assignable, which is not part of the CopyInsertable concept
Date: Thu, 16 Feb 2023 12:25:43 +0000	[thread overview]
Message-ID: <bug-108820-4@http.gcc.gnu.org/bugzilla/> (raw)

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	other threads:[~2023-02-16 12:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-16 12:25 marc.mutz at hotmail dot com [this message]
2023-02-16 12:50 ` [Bug libstdc++/108820] " redi at gcc dot gnu.org
2023-02-16 12:53 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-108820-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).