[llvm-bugs] [Bug 41017] New: Build failure with _LIBCPP_DEBUG=0 and non-const-ref comparator for std::sort()

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Mar 8 12:54:45 PST 2019


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: unassignedclangbugs at nondot.org
          Reporter: thomasanderson at google.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190308/41b22bb4/attachment.html>


More information about the llvm-bugs mailing list