[llvm-bugs] [Bug 50415] New: -Wreturn-type has many false positives

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 20 03:27:48 PDT 2021


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

            Bug ID: 50415
           Summary: -Wreturn-type has many false positives
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gonzalo.gadeschi at gmail.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Example  (https://clang.godbolt.org/z/66YqsGEha):

    int f(unsigned i) {
      if (i < unsigned(-1)) return i;
    }
    int g(unsigned i) {
      if (i >= 0) return i;
    }

compiled with clang++ -std=c++17 (no -Wall, no -Wextra) warns with

    warning: non-void function does not return a value in all control paths
[-Wreturn-type]

for both functions. 

AFAICT these warnings are false positives.

-- 
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/20210520/bfaffb13/attachment-0001.html>


More information about the llvm-bugs mailing list