Issue 107831
Summary [clang-tidy] Improve documentation of bugprone-pointer-arithmetic-on-polymorphic-object
Labels clang-tidy
Assignees
Reporter chrchr-github
    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. 
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to