summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/eh/cleanup2.C
blob: 9c9c5ad2c0fca74fdc2c784724593af249ba9dee (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// PR c++/12491
// { dg-do compile }
// { dg-options "-O2" }

// The return statements are necessary to trigger this bug.

class Object
{
public:
  virtual ~Object (void) { return; }
};

class AutoPtr
{
public:
  ~AutoPtr (void) { delete m_rep; return; }
private:
  const Object *m_rep;
};

class Handle
{
public:
  ~Handle (void) { return; }
private:
    AutoPtr m_rep;
};

class HandleOf:public Handle
{
public:
  ~HandleOf (void) { return; }
};

class Error
{
public:
  ~Error (void);
private:
  HandleOf m_hndl;
};

Error::~Error (void)
{
  return;
}