<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/185741>185741</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] False positive 'bugprone-derived-method-shadowing-base-method' with template method
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sjoubert
</td>
</tr>
</table>
<pre>
Branching off from #185636
See https://godbolt.org/z/qrM5nWEbs
```cpp
class Base
{
public:
virtual void work();
};
class Derived: public Base
{
public:
void work() override;
template <typename T>
void work();
};
```
```
<source>:13:5: warning: 'Derived::work' shadows method with the same name in class 'Base' [bugprone-derived-method-shadowing-base-method]
13 | void work();
| ^
<source>:4:5: note: previous definition of 'work' is here
4 | virtual void work();
| ^
1 warning generated.
```
The documentation specifies `Only checks public, non-templated methods.` but I'm not sure if it applies to the shadowing method, the shadowed one or both.
Without the non-template override of `Derived::work` I'd agree with the warning but given the override, I don't think it shadows anything. Am I missing something about the check reasoning or is it indeed a false positive?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVM2OqzgTfZrKppTI2AGSBQuSdKRefPoWc6W7NrgCvg02Y5u0Mk8_Mj-d233nRyMhYZVdx-dUHZf0XjeGqID0BOllI8fQWlf4H3asyIVNZdWjODlp6labBu3thjdnewQukkOaiQxYCaz8jQjbEAYPogR-BX5trKpsF3bWNcCvfwC__u7-l5rvL5WfUyBj81cPA7Cy7qT3eJKe4l5-AlYOY9XpOiKyEhHxrl0YZYd3qxW-W_cG_AD8COI0pVzmxQx0IafvpECUOMP8C_RnSLR3ck4rmiHjieUXqB86GQhBnMNjICN7wm8gXv4a6Au3D81f1-Ls7ehqikCiTASIMo3c36Uz2jRxCTx_igJRzpfk6Fup7LvHnkJrFb7r0GJoCX1kNtHTBueiAM-nKvAcIT1VYzM4a2irZtjtjLCdAbVptpX0tEQhvcwKE4GQn_FvtX7sQvryq7L9KszYQFNzHN21HT0qummjg7YG7S0yXfVpjy05Wuq7f97-T27AmcInKslaTWzIkJOB1O5LH761hMrWY08myImLH6jWN00eIWP_N90D65bqN7-4CvgZjTXb1RZqaYPfQcawGgO-As_7KBf96Aj1DXVAOQxdxAx2btVa8SU7oj7jpNAaQuuwsqHdza_nuw6tHcN07GcCH86dqpixXy2TsYmTQtk4oqdf1uJE0o2-k5miHw-Bn_EVlTXA83irNm9RyGo-aR4x1uyw7PEVe-19xPI2CoorWa1sp_qhI-ntdJ91scU6oDaKSKHEm-w84WC9DvpOIK4bVQh1FEe5oSLJc5Hk_LDnm7ZIk2xPgvKa58dDFk8kB6J9LemYk8zSjS444xkTCeOMsT3f5Rmjg6qOB1UdjvJYwZ5RL3W367p7H4fVRns_UpEc0nyfbDpZUeen4ch53UnTbINWD-A8DktXxKxtNTYe9qzTPvgnTtChm8bqT2npBa-fxEWj_7d3yPOlZWvD5_hmdF3xZQLr0I7VrrY98Guktfy2g7M_qA7Ar5NWD_y6yL0X_M8AAAD__2lu6Ng">