https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65942
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |rejects-valid Status|UNCONFIRMED |NEW Last reconfirmed| |2015-04-30 Summary|cannot use std::function as |[5/6 Regression] [C++14] |comparator in algorithms |cannot use std::function as | |comparator in algorithms Ever confirmed|0 |1 Severity|critical |normal --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- The <experimental/optional> header is not relevant to the bug. The error only happens in C++14 mode. #include <algorithm> #include <functional> bool cmp1(const int& a, const int& b) { return a < b; } std::function<bool (const int&, const int&)> cmp2 = cmp1; int main() { int v[1]; std::sort(v, v, cmp1); // works std::sort(v, v, cmp2); // fails }