[ownership] tests for pointer arithmetic

Reviewed By: jeremydubreil

Differential Revision: D7495530

fbshipit-source-id: 0685772
master
Sam Blackshear 7 years ago committed by Facebook Github Bot
parent 9180ff56c1
commit 94c2cd1d3b

@ -8,6 +8,7 @@
*/
#include <string>
#include <vector>
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<Aggregate> v) {
for (auto it = v.begin(); it != v.end(); ++it) {
it->~Aggregate();
}
}

Loading…
Cancel
Save