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] - Diff between revs 154 and 816

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
// PR c++/4460
// PR c++/4460
// Test that the cleanup for fully-constructed subobjects when a
// Test that the cleanup for fully-constructed subobjects when a
// constructor throws gets the right address for a virtual base.
// constructor throws gets the right address for a virtual base.
// { dg-do run }
// { dg-do run }
int r;
int r;
void *p;
void *p;
struct VBase
struct VBase
{
{
  virtual void f () {}
  virtual void f () {}
  VBase() { p = this; }
  VBase() { p = this; }
  ~VBase() { if (p != this) r = 1; }
  ~VBase() { if (p != this) r = 1; }
};
};
struct  StreamBase
struct  StreamBase
{
{
  virtual ~StreamBase() {}
  virtual ~StreamBase() {}
};
};
struct  Stream : public virtual VBase, public StreamBase
struct  Stream : public virtual VBase, public StreamBase
{
{
  Stream() {}
  Stream() {}
  virtual ~Stream() {}
  virtual ~Stream() {}
};
};
struct DerivedStream : public Stream
struct DerivedStream : public Stream
{
{
  DerivedStream() { throw 1; }
  DerivedStream() { throw 1; }
};
};
int main() {
int main() {
  try
  try
    {
    {
      DerivedStream str;
      DerivedStream str;
    }
    }
  catch (...) { }
  catch (...) { }
  return r;
  return r;
}
}
 
 

powered by: WebSVN 2.1.0

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