[LLVMbugs] [Bug 20675] New: missing -Wreturn-type on a function try block with no return

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Aug 15 10:07:12 PDT 2014


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

            Bug ID: 20675
           Summary: missing -Wreturn-type on a function try block with no
                    return
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: msebor at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Both Clang 3.4 and recent trunk diagnose functions f1 and f2 for possibly
flowing off the end, but fail to diagnose the missing return statement in
function f3 flowing off the end of the function-try-block:

$ cat z.c && ./llvm-head-gcc-4.8.2-x86_64-linux/Debug+Asserts/bin/clang -m32
-Wreturn-type -fsyntax-only -xc++ z.c
int f0 ();

int f1 () { if (f0 () < 0) return -1; }
int f2 () { try { return f0 (); } catch (...) { } }
int f3 () try { return f0 (); } catch (...) { }
z.c:3:39: warning: control may reach end of non-void function [-Wreturn-type]
int f1 () { if (f0 () < 0) return -1; }
                                      ^
z.c:4:51: warning: control may reach end of non-void function [-Wreturn-type]
int f2 () { try { return f0 (); } catch (...) { } }
                                                  ^
2 warnings generated.

-- 
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/20140815/a80f0ea2/attachment.html>


More information about the llvm-bugs mailing list