------- Comment #19 from hjl dot tools at gmail dot com 2008-12-11 16:49 ------- 1081 { 1082 m_alloc.set_throw_prob(0); 1083 value_type v = test_traits::generate_value(m_g, m_m); 1084 m_alloc.set_throw_prob(m_tp); 1085 const_key_reference r_k = test_traits::extract_key(v); 1086 typename cntnr::const_point_iterator found_it = m_p_c->find(r_k); 1087 const bool existed = (found_it != m_p_c->end()); 1088 const std::pair<typename cntnr::point_iterator, bool> ins_ret = m_p_c->insert(v); 1089 1090 if (ins_ret.second) (gdb) p &r_k $3 = (const __gnu_pbds::test::basic_type *) 0x7fffffffc6c0 (gdb) p &v.first $4 = (const __gnu_pbds::test::basic_type *) 0x7fffffffc750 (gdb) p $rsp $5 = (void *) 0x7fffffffc710 (gdb)
For some reason, test_traits::extract_key doesn't return the reference to v.first directly and returns a reference to a stack temporary instead. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37144