[LLVMbugs] [Bug 12318] New: -Wreturn-type warns on else if chains when last else if always true

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Mar 20 14:56:08 PDT 2012


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

             Bug #: 12318
           Summary: -Wreturn-type warns on else if chains when last else
                    if always true
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: rtrieu at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Given an else if chain that has a return statement in each body, and the last
else if condition is always true, -Wreturn-type warns.

int foo(int x) {
  if (x == 5) {
    return 1;
  } else if (x == 3 || true) {
    return 0;
  }
}


return-type.cc:7:1: warning: control may reach end of non-void function
      [-Wreturn-type]
}
^

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list