https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65942
Markus Trippelsdorf <trippels at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |trippels at gcc dot gnu.org --- Comment #4 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- Well, clang rejects your testcase, too. test2.cpp:20:31: error: indirection requires pointer operand ('int' invalid) { return bool(_M_comp(*__it1, *__it2)); } ^~~~~~ /usr/lib64/gcc/x86_64-pc-linux-gnu/5.1.1/include/g++-v5/functional:1981:27: note: in instantiation of function template specialization '_Iter_comp_iter<std::function<bool (const int &, const int &)> >::operator()<int, int>' requested here using _Invoke = decltype(__callable_functor(std::declval<_Functor&>()) ^ /usr/lib64/gcc/x86_64-pc-linux-gnu/5.1.1/include/g++-v5/functional:1990:2: note: in instantiation of template type alias '_Invoke' requested here using _Callable ^ /usr/lib64/gcc/x86_64-pc-linux-gnu/5.1.1/include/g++-v5/functional:2057:30: note: in instantiation of template type alias '_Callable' requested here typename = _Requires<_Callable<_Functor>, void>> ^ /usr/lib64/gcc/x86_64-pc-linux-gnu/5.1.1/include/g++-v5/functional:2058:2: note: in instantiation of default argument for 'function<_Iter_comp_iter<std::function<bool (const int &, const int &)> > >' required here function(_Functor); ^~~~~~~~ test2.cpp:31:14: note: while substituting deduced template arguments into function template 'function' [with _Functor = _Iter_comp_iter<std::function<bool (const int &, const int &)> >, $1 = (no value)] auto cmp = __iter_comp_iter(cmp2); ^ 1 error generated.