llvm / llvm/llvm-project

[clang-tidy] `performance-for-range-copy` not reported with non-const/const overloaded member call

Open
#175,033 7 comments 0 reactions 1 assignee Claimed by @vbvictor View on GitHub
clang-tidy enhancement
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

```cpp
#include
#include

struct S
{
int get() const;
int get(); // disable for warning to appear
};

std::map func();

void f()
{
const std::map m = func();
for (auto p : m) // const ref
{
if (p.second.get()) {}
}
}
```
https://godbolt.org/z/3rMWfnaKq

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.