Fix test-suite fallout of default -Wreturn-type.
[official-gcc.git] / gcc / testsuite / g++.dg / warn / Wnvdtor-4.C
blobdd6d9d7689ea175737c6c2c52d4b3663fc58a210
1 // { dg-do compile }
2 // { dg-options "-Weffc++ -Wno-non-virtual-dtor" }
4 // Warn when a class has virtual functions and accessible non-virtual
5 // destructor, in which case it would be possible but unsafe to delete
6 // an instance of a derived class through a pointer to the base class.
8 struct A
10 protected:
11   ~A();
12 public:
13   virtual void f() = 0;
16 struct B
18 private:
19   ~B();
20 public:
21   virtual void f() = 0;
24 struct C
26   virtual void f() = 0;
29 struct D
31   ~D();
32   virtual void f() = 0;
35 struct E;
37 struct F
39 protected:
40   friend class E;
41   ~F();
42 public:
43   virtual void f() = 0;
46 struct G
48 private:
49   friend class E;
50   ~G();
51 public:
52   virtual void f() = 0;
55 struct H {};
57 struct I1 : H
58 {};
59 struct I2 : private H
60 {};
62 struct J1 : H
63 { virtual ~J1 ();};
64 struct J2 : private H
65 { virtual ~J2 ();};
67 struct K 
69   virtual void k ();
72 struct L1 : K
73 {virtual ~L1 ();};
74 struct L2 : private K
75 {virtual ~L2 ();};