You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bugThis behavior is unintended and should be fixed.coreTopics concerning the core segments of the compiler (frontend, midend, parser)fixedThis topic is considered to be fixed.
Note that regardless whether element existed in the map or not, value is replaced. The bool result indicates whether the key was replaced and this is non-standard as well. Normally we expect from map inserts: a pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool value set to true if and only if the insertion took place.
Such behavior could lead to very subtle bugs in common pattern insert-or-merge, e.g.:
hvec_map<key, value> m;
auto [it, inserted] = m.insert({something, something_else});
if (!inserted)
merge(it->second, something_else);
hvec_map::emplace has the same problem.
The text was updated successfully, but these errors were encountered:
I think the else in if ((new_key = erased[idx])) { should be removed to fix the issue. We cannot override value for non-erased entries.
fruffy
added
bug
This behavior is unintended and should be fixed.
core
Topics concerning the core segments of the compiler (frontend, midend, parser)
labels
Feb 4, 2024
bugThis behavior is unintended and should be fixed.coreTopics concerning the core segments of the compiler (frontend, midend, parser)fixedThis topic is considered to be fixed.
hvec_map::insert
looks like this:Note that regardless whether element existed in the map or not, value is replaced. The
bool
result indicates whether the key was replaced and this is non-standard as well. Normally we expect from map inserts: a pair consisting of an iterator to the inserted element (or to the element that prevented the insertion) and a bool value set to true if and only if the insertion took place.Such behavior could lead to very subtle bugs in common pattern
insert-or-merge
, e.g.:hvec_map::emplace
has the same problem.The text was updated successfully, but these errors were encountered: