https://llvm.org/bugs/show_bug.cgi?id=31537
Bug ID: 31537 Summary: std::sort and std::unique can not use std::function with -std=c++14 Product: clang Version: 3.8 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P Component: C++14 Assignee: unassignedclangb...@nondot.org Reporter: d...@gmx.net CC: llvm-bugs@lists.llvm.org Classification: Unclassified The following two minimal examples both compile with clang++ -std=c++11 main.cpp but do not with clang++ -std=c++14 main.cpp // example 1 #include <algorithm> #include <functional> #include <vector> int main() { std::vector<int> xs = {0,1,2}; std::function<bool(int x, int y)> cmp = [](int x, int y) { return x < y; }; std::sort(std::begin(xs), std::end(xs), cmp); } // example 2 #include <algorithm> #include <functional> #include <vector> int main() { std::vector<int> xs = {0,1,2}; std::function<bool(int x, int y)> p = [](int x, int y) { return x == y; }; std::unique(std::begin(xs), std::end(xs), p); } The error message looks like this: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/algorithm:61: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/stl_algobase.h:71: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/bits/predefined_ops.h:123:31: error: indirection requires pointer operand ('int' invalid) { return bool(_M_comp(*__it1, *__it2)); } The used version is the default one from the package manager in Ubuntu 16.04: clang++ --version clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) Target: x86_64-pc-linux-gnu Thread model: posix InstalledDir: /usr/bin -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs