Issue 209302
Summary clang-tidy `cppcoreguidelines-missing-std-forward` false positive on example from docs on Windows
Labels clang-tidy, false-positive
Assignees
Reporter pum1k
    The `cppcoreguidelines-missing-std-forward` clang-tidy triggers a warning on the example from the docs, where it should be fine.

Reproducer:
```c++
#include <utility>

template <typename T>
void impl(T);

template <class T>
void wrapper(T &&t)
{
 impl(std::forward<T>(t), 1, 2); // Correct
}
```

Expected result: No warning produced
Actual result:
```
> clang-tidy --checks=-*,cppcoreguidelines-missing-std-forward test.cpp --
1 warning generated.
D:\projects\CVUT-FEL\bp\experimental\vision-sim3d\test.cpp:7:18: warning: forwarding reference parameter 't' is never forwarded inside the function body [cppcoreguidelines-missing-std-forward]
    7 | void wrapper(T &&t)
      |                  ^
```

This issue occured on Windows on both 20.1.0 and the current version. I was not able to reproduce this issue on other platforms. Furthermore, when using clangd in editor, it handles the check correctly.

```
> clang-tidy --version 
LLVM (http://llvm.org/):
  LLVM version 22.1.0
 Optimized build.
```

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

Reply via email to