https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65861
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Last reconfirmed| |2021-12-06 Status|RESOLVED |NEW Resolution|FIXED |--- --- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #10) > GCC 10+ started to reject the code just the same as CLANG does. Clang doesn't reject it, libc++ does. Clang with libstdc++ accepts it, and so does GCC trunk (you just need some more headers for recent versions): #include <string> #include <streambuf> #include <istream> #include <iterator> #include <algorithm> void f(std::istream &s, std::string x) { std::istreambuf_iterator<char> eod; std::search(std::istreambuf_iterator<char>(s), eod, x.begin(), x.end()); } Reopened.