http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57899
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Reduced a bit more to only depend on std::bind
#include <functional>
using std::bind;
using std::placeholders::_1;
struct S { int i; };
struct P { S s; };
struct get_s
{
const S& operator()(const P& p) const { return p.s; }
} gs;
int gi(const S& s) { return s.i; }
bool cmp(int, int) { return true; }
int main()
{
P p{};
auto f1 = bind(gs, _1);
auto f2 = bind(gi, f1);
auto f3 = bind(cmp, f2, 5);
f3(p);
}