Just like the recently-added checks for empty entries, add checks for
deleted entries as well. This didn't catch any problems, but it might
prevent future accidents. Suggested by David Malcolm.
for gcc/ChangeLog
* hash-map.h (put, get_or_insert): Check that added entry
doesn't look deleted either.
* hash-set.h (add): Likewise.
if (ins)
{
e->m_key = k;
- new ((void *) &e->m_value) Value (v);
- gcc_checking_assert (!Traits::is_empty (*e));
+ new ((void *)&e->m_value) Value (v);
+ gcc_checking_assert (!Traits::is_empty (*e)
+ && !Traits::is_deleted (*e));
}
else
e->m_value = v;
{
e->m_key = k;
new ((void *)&e->m_value) Value ();
- gcc_checking_assert (!Traits::is_empty (*e));
+ gcc_checking_assert (!Traits::is_empty (*e)
+ && !Traits::is_deleted (*e));
}
if (existed != NULL)
{
new (e) Key (k);
// Catch attempts to insert e.g. a NULL pointer.
- gcc_checking_assert (!Traits::is_empty (*e));
+ gcc_checking_assert (!Traits::is_empty (*e)
+ && !Traits::is_deleted (*e));
}
return existed;