[LLVMbugs] [Bug 23984] New: -Wtautological-compare doesn't warn on comparing default-initialized enums
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Jun 29 08:40:51 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=23984
Bug ID: 23984
Summary: -Wtautological-compare doesn't warn on comparing
default-initialized enums
Product: clang
Version: trunk
Hardware: PC
OS: All
Status: NEW
Severity: normal
Priority: P
Component: Frontend
Assignee: unassignedclangbugs at nondot.org
Reporter: nicolasweber at gmx.de
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Consider this snippet, where someone tried to call GetVersion() but instead
default-initialized an enum:
$ cat test.cc
namespace base {
enum Version { kXP, kVista };
Version GetVersion();
}
void f() {
if (base::Version() == base::kXP)
;
}
I'd expect that comparison to be flagged by -Wtautological-compare, but it
isn't:
$ bin/clang -Weverything test.cc -c
test.cc:6:6: warning: no previous prototype for function 'f'
[-Wmissing-prototypes]
void f() {
^
1 warning generated.
--
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/20150629/e9f420e3/attachment.html>
More information about the llvm-bugs
mailing list