https://bugs.llvm.org/show_bug.cgi?id=41017

            Bug ID: 41017
           Summary: Build failure with _LIBCPP_DEBUG=0 and non-const-ref
                    comparator for std::sort()
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: thomasander...@google.com
                CC: llvm-bugs@lists.llvm.org, mclow.li...@gmail.com

libc++ version is close to ToT:
https://chromium.googlesource.com/chromium/llvm-project/libcxx/+/9ae8fb4a3c5fef4e9d41e97bbd9397a412932ab0

Building the below program with libc++ succeeds, but fails when
-D_LIBCPP_DEBUG=0 is used (build failure: https://godbolt.org/z/AOroMY). 
Changing "int&" to "const int&" gets rid of the error.  The build should either
succeed or fail in both configurations.

#include <algorithm>
#include <vector>
int main() {
    std::vector<int> v;
    std::sort(v.begin(), v.end(), [](int& i1, int& i2) {
        return false;
    });
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to