https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92798
Joseph Tilahun <josephttilahun at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |josephttilahun at gmail dot com --- Comment #4 from Joseph Tilahun <josephttilahun at gmail dot com> --- I encountered this same bug when using -fshort-enums with std::map iterators. The fact that -fshort-enums breaks std::map iterators implies that there's an enum somewhere without an explicit underlying type. In /usr/include/c++/9/bits/stl_tree.h, there's an enum that enumerates the possible colors of a node of a red-black tree: enum _Rb_tree_color { _S_red = false, _S_black = true }; struct _Rb_tree_node_base { typedef _Rb_tree_node_base* _Base_ptr; typedef const _Rb_tree_node_base* _Const_Base_ptr; _Rb_tree_color _M_color; _Base_ptr _M_parent; _Base_ptr _M_left; _Base_ptr _M_right; // Other code that's not relevant } The _Rb_tree_color enum does not have an explicit underlying type. I tried modifying this to: enum _Rb_tree_color : int { _S_red = false, _S_black = true }; struct _Rb_tree_node_base { typedef _Rb_tree_node_base* _Base_ptr; typedef const _Rb_tree_node_base* _Const_Base_ptr; _Rb_tree_color _M_color; _Base_ptr _M_parent; _Base_ptr _M_left; _Base_ptr _M_right; // Other code that's not relevant } and -fshort-enums does not break this. I also tried modifying this to: enum _Rb_tree_color { _S_red = false, _S_black = true }; struct _Rb_tree_node_base { typedef _Rb_tree_node_base* _Base_ptr; typedef const _Rb_tree_node_base* _Const_Base_ptr; int _M_color; _Base_ptr _M_parent; _Base_ptr _M_left; _Base_ptr _M_right; // Other code that's not relevant } and -fshort-enums does not break this. It seems to me that the _Rb_tree_color enum is the real problem. -fshort-enums simply exposes the fact that the _Rb_tree_color enum does not have an explicit underlying type. Is there a reason why the _Rb_tree_color enum does not have an explicit underlying type?