diff --git a/infer/tests/codetoanalyze/cpp/ownership/basics.cpp b/infer/tests/codetoanalyze/cpp/ownership/basics.cpp index 2e07dda42..059af3ef6 100644 --- a/infer/tests/codetoanalyze/cpp/ownership/basics.cpp +++ b/infer/tests/codetoanalyze/cpp/ownership/basics.cpp @@ -8,6 +8,7 @@ */ #include +#include struct Aggregate { int i; @@ -73,3 +74,15 @@ int multiple_invalidations_loop_bad(int n, int* ptr) { } return *ptr; } + +Aggregate* pointer_arithmetic_ok(Aggregate* a) { + a->~Aggregate(); + a++; + return a; +} + +void iterator_pointer_arithmetic_ok(std::vector v) { + for (auto it = v.begin(); it != v.end(); ++it) { + it->~Aggregate(); + } +}