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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [g++.dg/] [eh/] [ctor2.C] - Blame information for rev 825

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

Line No. Rev Author Line
1 149 jeremybenn
// PR c++/4460
2
// Test that the cleanup for fully-constructed subobjects when a
3
// constructor throws gets the right address for a virtual base.
4
 
5
// { dg-do run }
6
 
7
int r;
8
void *p;
9
 
10
struct VBase
11
{
12
  virtual void f () {}
13
  VBase() { p = this; }
14
  ~VBase() { if (p != this) r = 1; }
15
};
16
 
17
struct  StreamBase
18
{
19
  virtual ~StreamBase() {}
20
};
21
 
22
struct  Stream : public virtual VBase, public StreamBase
23
{
24
  Stream() {}
25
  virtual ~Stream() {}
26
};
27
 
28
struct DerivedStream : public Stream
29
{
30
  DerivedStream() { throw 1; }
31
};
32
 
33
int main() {
34
 
35
  try
36
    {
37
      DerivedStream str;
38
    }
39
  catch (...) { }
40
 
41
  return r;
42
}

powered by: WebSVN 2.1.0

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