------- 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