[LLVMbugs] [Bug 5190] New: missing warnings on switch(boolean_expr)

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Oct 14 13:28:44 PDT 2009


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

           Summary: missing warnings on switch(boolean_expr)
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: ASSIGNED
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: zhanyong.wan at gmail.com
        ReportedBy: zhanyong.wan at gmail.com
                CC: clattner at apple.com, llvmbugs at cs.uiuc.edu,
                    nlewycky at google.com


Clang should warn on switch(bool) since it's almost certainly wrong
(developers seem okay with using if-statements instead).

int test2(const char *foo) {
  int success = 0;
  switch (foo && foo[0]) {  /* XXX */
    case 0:
      success = 1;
      break;
    case 1:
      break;
  }
  return success;
}


-- 
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