Issue 179090
Summary [clang-tidy][false-positive] `performance-unnecessary-value-param` when passing `std::function` into `std::map::try_emplace`
Labels clang-tidy, false-positive
Assignees
Reporter tearfur
    clang-tidy warns `performance-unnecessary-value-param` when passing an `std::functional` rvalue into `std::map::try_emplace()`. `std::map::try_emplace()` will (in some cases) move from rvalues passed into it, so I think the warning is bogus.

https://godbolt.org/z/bjYqaP857

```
<source>:6:33: warning: the parameter 'f' of type 'std::function<void ()>' is copied for each invocation but only used as a const reference; consider making it a const reference [performance-unnecessary-value-param]
    6 | void func(std::function<void()> f) {
      |                                 ^
 |           const                &
1 warning generated.
```

Current trunk: 487de1ad7b11c9faad9b890b37e0dec44433fc04
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to