clang-tidy bugprone-forwarding-reference-overload false positive on = delete; constructor #88128
Closed
Description
The bugprone-forwarding-reference-overload check in clang-tidy will warn even for a = delete; constructor:
// main.cpp
class Foo {
public:
// ...
template <typename T>
Foo(T&&) = delete;
// ...
};clang-tidy -checks=bugprone-* main.cpp
/path/to/main.cpp:5:3: warning: constructor accepting a forwarding reference can hide the copy and move constructors [bugprone-forwarding-reference-overload]
5 | Foo(T&&) = delete;
| ^In our case, we had various templated constructors and it looks like the original author decided to explicitly delete this to warn/prevent somebody making this mistake in the future.
$ clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 17.0.6
Optimized build.
Activity