1// { dg-do run { xfail sparc64-*-elf arm-*-pe } }
2// { dg-options "-fexceptions" }
3
4int count;
5
6class Foo {
7public:
8  Foo() { ++count; }
9  Foo(const Foo&) { ++count; }
10  ~Foo() { --count; }
11};
12
13
14int main() {
15  try {
16    throw Foo();
17  }
18  catch (Foo& object) {
19    if (count == 1)
20      return 0;
21  }
22  return 1;
23}
24