#include using namespace std; struct S { int x; }; void _dtor_S(S * s) { cout << "called destructor!" << endl; } S f() { throw 3; return (S) { 0 }; } void _ctor_S(struct S *s, struct S) { s->x = 123; } int main() { try { // __attribute__((cleanup(_dtor_S))) S s = f(); struct S _tmp1; struct S _tmp2 = (_ctor_S(&_tmp2, _tmp1), _tmp2); cout << _tmp2.x << endl; } catch(...) { } }