[llvm-bugs] [Bug 36186] New: False negatives for -Wconstant-conversion in enums
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Jan 31 20:40:48 PST 2018
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: unassignedclangbugs at nondot.org
Reporter: smeenai at fb.com
CC: compnerd at compnerd.org, dgregor at apple.com,
llvm-bugs at lists.llvm.org, richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180201/ca07a60d/attachment.html>
More information about the llvm-bugs
mailing list