[clang-tools-extra] Fix #179090: [clang-tidy][false-positive] `performance-unnecessary-value-param` when passing `std::function` rvalue into `std::map::try_emplace` (PR #180806)

Roberto Turrado Camblor via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 11 12:52:41 PST 2026


rturrado wrote:

> Is it false-negative instead of false positive? since it looks like miss to diag something

Thanks for checking this.

I tried to mimick the `map.try_emplace(0, f)`, `f` of type `std::function<void()>`, with a test, but I hadn't checked against the original [program](https://godbolt.org/z/bjYqaP857) itself. I have tried now and I have seen 2 problems:

1. `map.try_emplace(0, f)` is indeed a false negative (it doesn't emit any warning).
2. `map.try_emplace(0, std::move(f)` is a false positive (it recommends to move).

https://github.com/llvm/llvm-project/pull/180806


More information about the cfe-commits mailing list