OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [Wnvdtor-2.C] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 693 jeremybenn
// PR c++/7302
2
// { dg-do compile }
3
// { dg-options "-Wnon-virtual-dtor" }
4
 
5
// Warn when a class has virtual functions and accessible non-virtual
6
// destructor, in which case it would be possible but unsafe to delete
7
// an instance of a derived class through a pointer to the base class.
8
 
9
struct A // { dg-bogus "non-virtual destructor" }
10
{
11
protected:
12
  ~A();
13
public:
14
  virtual void f() = 0;
15
};
16
 
17
struct B // { dg-bogus "non-virtual destructor" }
18
{
19
private:
20
  ~B();
21
public:
22
  virtual void f() = 0;
23
};
24
 
25
struct C // { dg-warning "non-virtual destructor" }
26
{
27
  virtual void f() = 0;
28
};
29
 
30
struct D // { dg-warning "non-virtual destructor" }
31
{
32
  ~D();
33
  virtual void f() = 0;
34
};
35
 
36
struct E;
37
 
38
struct F // { dg-warning "non-virtual destructor" }
39
{
40
protected:
41
  friend class E;
42
  ~F();
43
public:
44
  virtual void f() = 0;
45
};
46
 
47
struct G // { dg-warning "non-virtual destructor" }
48
{
49
private:
50
  friend class E;
51
  ~G();
52
public:
53
  virtual void f() = 0;
54
};

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.