public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "b.stanimirov at abv dot bg" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/108714] New: Algorithms in <algorithm> require predicates to be copyable
Date: Wed, 08 Feb 2023 08:56:27 +0000	[thread overview]
Message-ID: <bug-108714-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 108714
           Summary: Algorithms in <algorithm> require predicates to be
                    copyable
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: b.stanimirov at abv dot bg
  Target Milestone: ---

Simple repro:

```
#include <algorithm>
#include <vector>

struct noncopyable {
    noncopyable();
    noncopyable(const noncopyable&) = delete;
    noncopyable(noncopyable&&) noexcept = default;
    template <typename T>
    bool operator()(const T&);
};

bool all_of_vec(const std::vector<int>& vec) {
    return std::all_of(vec.begin(), vec.end(), noncopyable{});
}
```

This does not compile, because the predicate to `all_of` is not copyable. The
same error appears for all other algorithms which allow a predicate.

It does compile and work and expected with Microsoft STL and with libc++

Live demo showing compilation errors with libstdc++ and successful compilation
with libc++ and Microsoft STL: https://godbolt.org/z/xaa35G35e

             reply	other threads:[~2023-02-08  8:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-08  8:56 b.stanimirov at abv dot bg [this message]
2023-02-08 11:28 ` [Bug libstdc++/108714] " 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-108714-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).