[clang-tools-extra] [clang-tidy] Improve documentation of bugprone-pointer-arithmetic-on-polymorphic-object (PR #108324)

Nicolas van Kempen via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 12 09:13:36 PDT 2024


================
@@ -50,14 +65,19 @@ Options
     void bar() {
       Base *b = new Base[10];
       b += 1; // warning, as Base declares a virtual destructor
-  
+
       delete[] b;
-  
+
       Derived *d = new Derived[10]; // Derived overrides the destructor, and
                                     // declares no other virtual functions
       d += 1; // warning only if IgnoreVirtualDeclarationsOnly is set to false
-  
+
       delete[] d;
+
+      FinalDerived *f = new FinalDerived[10];
+      f += 1; // no warning, FinalDerived is final and cannot be further derived
+
+      delete[] f;
----------------
nicovank wrote:

```suggestion
```

Not relevant to the option.

https://github.com/llvm/llvm-project/pull/108324


More information about the cfe-commits mailing list