1 2 3 4 5 6 7 8 9 10 11 12 13 14
#include "byval1.h" void *p[2]; int i; int r; C::C() { p[i++] = this; } C::~C() { if (p[--i] != this) r = 1; } void Foo (C c) { p[i++] = &c; }