diff --git a/include/oneapi/tbb/concurrent_hash_map.h b/include/oneapi/tbb/concurrent_hash_map.h index 87881f5310..288182fd8d 100644 --- a/include/oneapi/tbb/concurrent_hash_map.h +++ b/include/oneapi/tbb/concurrent_hash_map.h @@ -443,9 +443,11 @@ class hash_map_iterator { if( k&(k-2) ) // not the beginning of a segment ++my_bucket; else my_bucket = my_map->get_bucket( k ); - my_node = static_cast( my_bucket->node_list.load(std::memory_order_relaxed) ); - if( map_base::is_valid(my_node) ) { - my_index = k; return; + node_base *n = my_bucket->node_list.load(std::memory_order_relaxed); + if( map_base::is_valid(n) ) { + my_node = static_cast(n); + my_index = k; + return; } ++k; }