[LLVMbugs] [Bug 5879] New: warn on truncating enum to bool

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Fri Dec 25 09:44:02 PST 2009


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

           Summary: warn on truncating enum to bool
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: daniel at zuster.org
                CC: llvmbugs at cs.uiuc.edu


MSVC has this, and its nice:
--
enum e0 { A = 1 };
bool f0() {
  bool a = A; // expected-warning {{ truncation from 'enum e0' to 'bool' }}
  return a && b && c;
}
--

It may require some tuning for specific enum values to avoid false positives.

The MSVC docs seem to indicate their warning is just part of a generic
truncation warning.
  http://msdn.microsoft.com/en-us/library/0as1ke3f(VS.80).aspx


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