http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58569
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- This might be a front-end bug, I'm struggling to reduce it though. If I produce prepreocessed code then clang++ compiles it fine. Adding this to the global namespace (so that version gets found by unqualified lookup instead of std::__callable_function) fixes the error: template<typename _Functor> inline _Functor& __callable_functor(_Functor& __f) { return __f; } So there seems to be some interaction with the std::__callable_function overloads.