------- Comment #7 from paolo dot carlini at oracle dot com 2008-12-12 11:53 ------- (In reply to comment #6) > But there is no space for _Rb_tree_node<_Val> in ctx.foo._M_t._M_impl. > > struct _Rb_tree_impl : public _Node_allocator > { > _Key_compare _M_key_compare; > _Rb_tree_node_base _M_header; > size_type _M_node_count;
This has nothing to do with the allocated nodes. > > the _M_header member is of type _Rb_tree_node_base, so I don't see how you > can cast that to _Rb_tree_node<_Val> and expect the _M_value_field to > magically > appear in memory. Hey Richard, don't tell me it's the first time you see production code casting a pointer from base to derived and accessing a member existing only in the derived type. Indeed, the HP / SGI STL people did that, not the worse programmers in the world ;) Anyway, if you think this is something wrong from the aliasing specifications point of view, please point me to the relevant sections of the Standard, let's work this out, is going to be painful and risky, I'm afraid... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38477