------- Comment #1 from bangerth at gmail dot com 2010-04-07 23:16 ------- (In reply to comment #0) > I think the C++ standard can definitely be read to allow this optimization
I would most definitely think so. 7.2/6 specifically says that the values an enum variable can take on are, in your example, 0...3. See, in particular, footnote 81 in C++98. Everything outside would invoke undefined behavior, and I like that the compiler can make inferences from that. Don't we already have a warning that warns about assigning values outside the range of an enum? W. -- bangerth at gmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |manu at gcc dot gnu dot org, | |bangerth at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43680