http://llvm.org/bugs/show_bug.cgi?id=21389

            Bug ID: 21389
           Summary: detect non-strick-weak-order where one is required
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

The static analyzer should flag this sort of code:

  std::nth_element(
      id_map.begin(),
      id_map.begin() + num_ids,
      id_map.end(), [](const pair<Id, float> &lhs,
                       const pair<Id, float> &rhs) {
        return lhs.second <= rhs.second;
      });

because the lambda function may return true for a given pair of inputs, and
return true again if you switch lhs and rhs.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to