OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [g++.old-deja/] [g++.abi/] [vbase4.C] - Diff between revs 305 and 338

Only display areas with differences | Details | Blame | View Log

Rev 305 Rev 338
// { dg-do run  }
// { dg-do run  }
// Copyright (C) 2001 Free Software Foundation, Inc.
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 9 Jun 2001 
// Contributed by Nathan Sidwell 9 Jun 2001 
// Bug 3089. We ICE'd in construction vtables.
// Bug 3089. We ICE'd in construction vtables.
int failed;
int failed;
void fail (int val)
void fail (int val)
{
{
  if (!failed)
  if (!failed)
    failed = val;
    failed = val;
}
}
struct A
struct A
{
{
  virtual ~A();
  virtual ~A();
  A ();
  A ();
  virtual void check (void *whole, void *base);
  virtual void check (void *whole, void *base);
};
};
A::A ()
A::A ()
{
{
  check (this, this);
  check (this, this);
}
}
A::~A ()
A::~A ()
{
{
  check (this, this);
  check (this, this);
}
}
void A::check (void *whole, void *base)
void A::check (void *whole, void *base)
{
{
  if (dynamic_cast  (this) != whole)
  if (dynamic_cast  (this) != whole)
    fail (1);
    fail (1);
  else if (this != base)
  else if (this != base)
    fail (2);
    fail (2);
}
}
struct B
struct B
{
{
  virtual ~B ();
  virtual ~B ();
  B ();
  B ();
  virtual void check (void *whole, void *base);
  virtual void check (void *whole, void *base);
};
};
B::B ()
B::B ()
{
{
  check (this, this);
  check (this, this);
}
}
B::~B ()
B::~B ()
{
{
  check (this, this);
  check (this, this);
}
}
void B::check (void *whole, void *base)
void B::check (void *whole, void *base)
{
{
  if (dynamic_cast  (this) != whole)
  if (dynamic_cast  (this) != whole)
    fail (3);
    fail (3);
  else if (this != base)
  else if (this != base)
    fail (4);
    fail (4);
}
}
struct C : virtual public B, virtual public A
struct C : virtual public B, virtual public A
{
{
  virtual ~C ();
  virtual ~C ();
  C ();
  C ();
  virtual void check (void *whole, void *base);
  virtual void check (void *whole, void *base);
};
};
C::C ()
C::C ()
{
{
  check (this, this);
  check (this, this);
}
}
C::~C ()
C::~C ()
{
{
  check (this, this);
  check (this, this);
}
}
void C::check (void *whole, void *base)
void C::check (void *whole, void *base)
{
{
  if (dynamic_cast  (this) != whole)
  if (dynamic_cast  (this) != whole)
    fail (5);
    fail (5);
  else if (this != base)
  else if (this != base)
    fail (6);
    fail (6);
  A::check (whole, static_cast  (this));
  A::check (whole, static_cast  (this));
  B::check (whole, static_cast  (this));
  B::check (whole, static_cast  (this));
}
}
struct D : virtual public A
struct D : virtual public A
{
{
  virtual ~D ();
  virtual ~D ();
  D ();
  D ();
  virtual void check (void *whole, void *base);
  virtual void check (void *whole, void *base);
};
};
D::D ()
D::D ()
{
{
  check (this, this);
  check (this, this);
}
}
D::~D ()
D::~D ()
{
{
  check (this, this);
  check (this, this);
}
}
void D::check (void *whole, void *base)
void D::check (void *whole, void *base)
{
{
  if (dynamic_cast  (this) != whole)
  if (dynamic_cast  (this) != whole)
    fail (5);
    fail (5);
  else if (this != base)
  else if (this != base)
    fail (6);
    fail (6);
  A::check (whole, static_cast  (this));
  A::check (whole, static_cast  (this));
}
}
struct E : virtual public C, virtual public D
struct E : virtual public C, virtual public D
{
{
  virtual ~E ();
  virtual ~E ();
  E ();
  E ();
  virtual void check (void *whole, void *base);
  virtual void check (void *whole, void *base);
};
};
E::E ()
E::E ()
{
{
  check (this, this);
  check (this, this);
}
}
E::~E ()
E::~E ()
{
{
  check (this, this);
  check (this, this);
}
}
void E::check (void *whole, void *base)
void E::check (void *whole, void *base)
{
{
  if (dynamic_cast  (this) != whole)
  if (dynamic_cast  (this) != whole)
    fail (5);
    fail (5);
  else if (this != base)
  else if (this != base)
    fail (6);
    fail (6);
  C::check (whole, static_cast  (this));
  C::check (whole, static_cast  (this));
  D::check (whole, static_cast  (this));
  D::check (whole, static_cast  (this));
}
}
struct F : virtual public E
struct F : virtual public E
{
{
  virtual ~F ();
  virtual ~F ();
  F ();
  F ();
  virtual void check (void *whole, void *base);
  virtual void check (void *whole, void *base);
};
};
F::F ()
F::F ()
{
{
  check (this, this);
  check (this, this);
}
}
F::~F ()
F::~F ()
{
{
  check (this, this);
  check (this, this);
}
}
void F::check (void *whole, void *base)
void F::check (void *whole, void *base)
{
{
  if (dynamic_cast  (this) != whole)
  if (dynamic_cast  (this) != whole)
    fail (5);
    fail (5);
  else if (this != base)
  else if (this != base)
    fail (6);
    fail (6);
  E::check (whole, static_cast  (this));
  E::check (whole, static_cast  (this));
}
}
int main ()
int main ()
{
{
  A a;
  A a;
  B b;
  B b;
  C c;
  C c;
  D d;
  D d;
  E e;
  E e;
  F f;
  F f;
  return failed;
  return failed;
}
}
 
 

powered by: WebSVN 2.1.0

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