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

            Bug ID: 97420
           Summary: error: no matching function for call to 'find_if'
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tangyixuan at mail dot dlut.edu.cn
  Target Milestone: ---

Hi, the following code maybe valid, since 'std::find_if' is allowed since
c++17.
https://en.cppreference.com/w/cpp/algorithm/find

$ cat s.cpp

# include <cctype>
# include <algorithm>

template<int (& F)(int)>
constexpr int A(unsigned char a) noexcept(noexcept(F(a)))
{ return F(a); }

int main()
{
    const char t[] = "a";

    std::find_if(t, t + 1, A<std::isspace>);
}

$ g++ -c -std=c++2a s.cpp
s.cpp: In function ‘int main()’:
s.cpp:12:43: error: no matching function for call to ‘find_if(const char [2],
const char*, <unresolved overloaded function type>)’
   12 |     std::find_if(t, t + 1, A<std::isspace>);
      |

Reply via email to