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

            Bug ID: 36186
           Summary: False negatives for -Wconstant-conversion in enums
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: smee...@fb.com
                CC: compn...@compnerd.org, dgre...@apple.com,
                    llvm-bugs@lists.llvm.org, richard-l...@metafoo.co.uk

% cat enum.cpp
enum { A = 128 };
void f(signed char);
void g() { f(A); }
% clang -target x86_64-linux -fsyntax-only -Wconstant-conversion enum.cpp

The implicit conversion from the enumeration type (which should be an unsigned
8 bit type) to the function parameter (a signed 8 bit type) causes a value
change from 128 to -128, but -Wconstant-conversion doesn't catch that. Upping
the enumeration value to anything above 255 shows the expected diagnostic.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to