public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/108714] New: Algorithms in <algorithm> require predicates to be copyable
@ 2023-02-08 8:56 b.stanimirov at abv dot bg
2023-02-08 11:28 ` [Bug libstdc++/108714] " redi at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: b.stanimirov at abv dot bg @ 2023-02-08 8:56 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-08 11:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-08 8:56 [Bug libstdc++/108714] New: Algorithms in <algorithm> require predicates to be copyable b.stanimirov at abv dot bg
2023-02-08 11:28 ` [Bug libstdc++/108714] " redi at gcc dot gnu.org
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).