according gcc c++11 support status website, typed enums available g++4.4 , greater.
however following not compile g++4.4:
enum class foo { value_1, value_2 }; int main() { foo = foo::value_1; foo b = foo::value_2; const bool test = ( < b ); } the error message error: invalid operands of types ‘foo’ , ‘foo’ binary ‘operator<’.
compilers accept code include g++-4.6, g++-4.7, g++-4.8 , clang++ 3.2. ( couldn't test g++-4.5 don't have installed (and ubuntu 13 doesn't want me to))
i provide fallback (rather old) compiler macro, dislike (where stop?...).
what's problem here? information of support wrong or bit missing that's not included in "support strongly-typed enums"? last option can think of: problem in code?
it's known bug. @casey found out, g++-4.4 did not support relational operations on strongly-typed enums. equality, fixed in version 4.4.1, fix other relations such < , > made 4.5.1 , above.
this original bug thread on gcc bugzilla: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064
Comments
Post a Comment