[libc++] Fix dangling reference in the associative container benchmarks (#213139)
Two insert benchmarks were registered with lambdas capturing insert_iter_iter_bench by reference, unlike every other registration in this file, which captures by value. RegisterBenchmark() stores the lambda by value and only invokes it from RunSpecifiedBenchmarks(), which happens long after associative_container_benchmarks() has returned, creating a dangling reference.
This commit is contained in:
parent
69685bb9ce
commit
dac66ca477
1 changed files with 2 additions and 2 deletions
|
|
@ -498,9 +498,9 @@ void associative_container_benchmarks(std::string container) {
|
|||
st.ResumeTiming();
|
||||
}
|
||||
};
|
||||
bench("insert(iterator, iterator) (all new keys, end)", [&](auto& state) { insert_iter_iter_bench(true, state); });
|
||||
bench("insert(iterator, iterator) (all new keys, end)", [=](auto& state) { insert_iter_iter_bench(true, state); });
|
||||
bench("insert(iterator, iterator) (all new keys, middle)",
|
||||
[&](auto& state) { insert_iter_iter_bench(false, state); });
|
||||
[=](auto& state) { insert_iter_iter_bench(false, state); });
|
||||
|
||||
bench("insert(iterator, iterator) (half new keys)", [=](auto& st) {
|
||||
const std::size_t size = st.range(0);
|
||||
|
|
|
|||
Loading…
Reference in a new issue