You start with f(2), so i=2. On line 20 when you create X(i+1) you set c=i+1=3 (see line 11). You set that value twice, but that's not a problem. Then you start deleting t[0], so you call the destructor on line 12. It will increase X::c to 4, and throw an error