https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114602
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |DUPLICATE Status|UNCONFIRMED |RESOLVED --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- This is a longstanding issue that glibc headers expose all APIs when included from C++ code. You can either cast the function pointer to the right type: std::sort(ptr, ptr, static_cast<bool(*)(foo, foo)>(bcmp)); or use a lambda expression: std::sort(ptr, ptr, [](foo l, foo r) { return bcmp(l, r); }); *** This bug has been marked as a duplicate of bug 11196 ***