| Issue |
181129
|
| Summary |
[clang-tidy] false positive portability-template-virtual-member-function with pure virtual methods in templated classes
|
| Labels |
clang-tidy,
false-positive
|
| Assignees |
|
| Reporter |
thijn-van-dijk
|
Version: LLVM 21.1.0
We encountered the portability-template-virtual-member-function clang-tidy error while compiling our code. I believe this to be a false positive.
The following code snippet causes this error to show:
`#include <cstdint>
template <typename T>
class Foo
{
public:
virtual T apply(T param, T param2) = 0;
};
class Bar : public Foo<uint16_t>
{
public:
uint16_t apply(uint16_t param, uint16_t param2) override
{
return param + param2;
};
};
int main()
{
Bar impl;
impl.apply(1, 2);
return 0;
}`
With clang-tidy disabled the code compiles and all calls to apply succeed.
Investigating this snipet in Compiler explorer (https://godbolt.org/z/eve4dsdvn) results in GCC, CLANG, and MSVC all compile to correct code.
Furthermore, I believe this snipet to be significantly different from the snippet in the documentation in https://clang.llvm.org/extra/clang-tidy/checks/portability/template-virtual-member-function.html and therefore I suspect this to be a false positive.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs