#include <stdio.h>

struct A {
    ~A() { printf("~A\n"); }
};

void g(int x)
{
    if (x)
        throw 42;
}

void f(int x)
{
    A a;
    g(x);
}

int main()
{
    try {
        f(1);
    }
    catch (int e) {
        printf("caught %d\n", e);
    }
    return 0;
}
