summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/eh/init-temp2.C
blob: 6a58dda1f97943bb6d7a85f4eb7b79092b4ae186 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// PR c++/34196
// { dg-options "-O -Wuninitialized" }

template <class _Tp> class AutoPtr
{
  _Tp* _M_ptr;

public:
  explicit AutoPtr(_Tp* __p = 0)  : _M_ptr(__p) {}

  ~AutoPtr() { delete _M_ptr; }
};

struct A
{
  A() { }
  ~A() { throw 1.0; }
};

struct B
{
  virtual ~B();
};

B* f (const A &s) { throw 1; }

int
main()
{
  AutoPtr<B> wt(f(A()));
}