[Bug c++/28236] wrong "control reaches" warning with enums.
manu at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Tue Jan 23 13:58:00 GMT 2007
------- Comment #5 from manu at gcc dot gnu dot org 2007-01-23 13:57 -------
I don't get this. The enum value can be any integer apart from foo and bar.
Moreover, since it is undefined, it can be literally anything! So you need a
"default:" case to handle that.
In the first testcase, without a default case, the function returns (when it
reaches the end) without a value, so the warning is correct.
In the second case, r is not initialized unless __e is X or Y (and if
out-of-range enum values are undefined in C++, __e can be anything!), thus the
warning seems correct as well.
So, is this really a bug?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28236
More information about the Gcc-bugs
mailing list