#include <iostream>

struct My {
    static int count;
    int id_;

    My(): id_{count++} {
        if (id_ == 10) throw 42;
    }

    ~My() {
        std::cout << "~" << id_ << std::endl;
    }
};

int My::count = 0;

int main() {
    try {
        new My[42];
    } catch (...) {

    }
}
