[LLVMbugs] [Bug 9143] New: -Wuninitialized suggests `= 0` for enums
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Feb 4 16:17:06 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9143
Summary: -Wuninitialized suggests `= 0` for enums
Product: clang
Version: trunk
Platform: PC
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: nicolasweber at gmx.de
CC: llvmbugs at cs.uiuc.edu
hummer:src thakis$ cat test.cc
enum A {
A_a, A_b
};
A f() {
A a;
return a;
}
hummer:src thakis$ ~/src/llvm-svn/Release+Asserts/bin/clang -c test.cc -Wall
test.cc:6:10: warning: variable 'a' is possibly uninitialized when used here
[-Wuninitialized]
return a;
^
test.cc:5:3: note: variable 'a' is declared here
A a;
^
test.cc:5:6: note: add initialization to silence this warning
A a;
^
= 0
1 warning generated.
But doing this is of course not valid:
hummer:src thakis$ cat test.cc
enum A {
A_a, A_b
};
A f() {
A a = 0;
return a;
}
hummer:src thakis$ ~/src/llvm-svn/Release+Asserts/bin/clang -c test.cc -Wall
test.cc:5:5: error: cannot initialize a variable of type 'A' with an rvalue of
type 'int'
A a = 0;
^ ~
1 error generated.
--
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