1 // PR c++/12491
2 // { dg-do compile }
3 // { dg-options "-O2" }
4 
5 // The return statements are necessary to trigger this bug.
6 
7 class Object
8 {
9 public:
~Object(void)10   virtual ~Object (void) { return; }
11 };
12 
13 class AutoPtr
14 {
15 public:
~AutoPtr(void)16   ~AutoPtr (void) { delete m_rep; return; }
17 private:
18   const Object *m_rep;
19 };
20 
21 class Handle
22 {
23 public:
~Handle(void)24   ~Handle (void) { return; }
25 private:
26     AutoPtr m_rep;
27 };
28 
29 class HandleOf:public Handle
30 {
31 public:
~HandleOf(void)32   ~HandleOf (void) { return; }
33 };
34 
35 class Error
36 {
37 public:
38   ~Error (void);
39 private:
40   HandleOf m_hndl;
41 };
42 
~Error(void)43 Error::~Error (void)
44 {
45   return;
46 }
47