http://llvm.org/bugs/show_bug.cgi?id=14820
Bug #: 14820
Summary: warn on invalid assignment
Product: clang
Version: unspecified
Platform: PC
OS/Version: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
I think this C code has undefined behaviour:
enum E { X, Y, Z };
void test() {
enum E e = -1;
}
and we don't currently warn on that. If you later query e == -1 we warn on
*that*, but that's somewhat redundant as UB has already occurred.
We have a similar problem in C++, but at least it's safer:
enum E { X, Y, Z };
void test() {
E e = (E)-1;
}
doesn't warn. We should also warn on 'return (E)-1;' and similar.
--
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs