<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/107831>107831</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-tidy] Improve documentation of bugprone-pointer-arithmetic-on-polymorphic-object
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-tidy
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chrchr-github
</td>
</tr>
</table>
<pre>
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/pointer-arithmetic-on-polymorphic-object.html
* The first example doesn't compile (`virtual void ~Base();`)
* The example also produces a clang-analyzer-cplusplus.NewDelete warning, which might lead to confusion
A better example could be
~~~c++
struct Base {
virtual ~Base();
int i;
};
struct Derived : public Base {};
int foo(const Derived d[]) {
return d[1].i;
}
~~~
In this case, making `Derived` `final` suppresses the warning.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMU8uOozoQ_RqzKYEcEyAsWCQdRerNXd0fMKbAnjY28iPdmUW-feS8u2cz4lXl0jlVR9Th3qvJIHak2pFqn_EYpHWdkE5Il08qyNhnvR1OnQxh8aTcEnYg7CA0N1Oh9XEurJsIO-BXcPxeyIMaTimRKD48YYc-TouzBgk7LFaZgC7nTgU5Y1AityZfrD7N1i0ypf0vFKGQYdaE7gndEraF_yXCqJwPgF98XjTCYNEbwpoAws6L0giEbUhNj8qFyDUcrRrgvOMe0zlrSbkjNU3BN9I7HdfewuLsEAV64HAVwg3Xp9_ocrHo6NNT_Iefe9QYED65M8pMhL3Bp1RCwqwmGUAjHyBYENaM0Strbg0v7y30GAK6R19hox6gx2v5fD4LwnbpvuQ-uCgCJBVAmtsh3CX-UHctgjIB1CMnzf4Zv3Lu0akjDkDKLSyx10o82_yFSZyjtYRthDX-CR6ue0NY-zIeADgM0ZlLeUWqffF9nrvUa_BuIEjlQVzEvMHMP5SZgNT01oXUNGWjMlyn2Mdlceg9egjy8RsKyIauHNqy5Rl2q4ZVm6aq1lUmOyoa0WxYvRl5OwhWUtw0WNXlKBq6ammTqY5RtqZtuirGqqKvm5ZjLVbrYRSCr8ma4syVfqx8pryP2K1osylXmeY9an8xEWOvFmDJVK5LqLyPkydrqpUP_skTVNAX-73Aqj28z4uzx7TlIs5oAg_KGrAj3K2U_6uRsuj0D_defV0IOxN2SJPcPvnibIIQdrjIS9a9KTx27E8AAAD__7T_VDQ">