[llvm-bugs] [Bug 47903] Possible bug in std::sort

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 19 08:57:56 PDT 2020


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

Marshall Clow (home) <mclow.lists at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |INVALID

--- Comment #1 from Marshall Clow (home) <mclow.lists at gmail.com> ---
Sorry, not a bug.

Your predicate:

    const auto cmp = [](const std::string &s1, const std::string &s2) {
        bool isLess = s1 < s2;
        isLess = !isLess;
        return isLess;
    };

does not impose a strict weak ordering on the data.
In particular, it returns true when comparing a string to itself.

-- 
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/20201019/ac960cd3/attachment.html>


More information about the llvm-bugs mailing list