[llvm-bugs] [Bug 45446] New: false positive: -Wtautological-type-limit-compare

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 6 06:48:33 PDT 2020


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

            Bug ID: 45446
           Summary: false positive: -Wtautological-type-limit-compare
           Product: clang
           Version: 9.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mathias at nedrebo.org
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The following code triggers the `tautological-type-limit-compare` warning on
64bit.

--------------------------------------------------------------------
uint64_t size = get();

if constexpr(std::numeric_limits<decltype(size)>::max() > 
             std::numeric_limits<size_t>::max())
{
    if(size > std::numeric_limits<size_t>::max())
        return ReturnCode::outOfRange;
}
--------------------------------------------------------------------


To me this looks like a false positive. Alternatively, is there a "better" way
to express this?

-- 
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/20200406/3c60ce0c/attachment.html>


More information about the llvm-bugs mailing list