From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/g++.old-deja/g++.abi/vbase4.C | 166 ++++++++++++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 gcc/testsuite/g++.old-deja/g++.abi/vbase4.C (limited to 'gcc/testsuite/g++.old-deja/g++.abi/vbase4.C') diff --git a/gcc/testsuite/g++.old-deja/g++.abi/vbase4.C b/gcc/testsuite/g++.old-deja/g++.abi/vbase4.C new file mode 100644 index 000000000..8b083947e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.abi/vbase4.C @@ -0,0 +1,166 @@ +// { dg-do run } +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 9 Jun 2001 + +// Bug 3089. We ICE'd in construction vtables. + +int failed; + +void fail (int val) +{ + if (!failed) + failed = val; +} + +struct A +{ + virtual ~A(); + A (); + virtual void check (void *whole, void *base); +}; + +A::A () +{ + check (this, this); +} +A::~A () +{ + check (this, this); +} + +void A::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (1); + else if (this != base) + fail (2); +} + +struct B +{ + virtual ~B (); + B (); + virtual void check (void *whole, void *base); +}; + +B::B () +{ + check (this, this); +} +B::~B () +{ + check (this, this); +} +void B::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (3); + else if (this != base) + fail (4); +} + +struct C : virtual public B, virtual public A +{ + virtual ~C (); + C (); + virtual void check (void *whole, void *base); +}; +C::C () +{ + check (this, this); +} +C::~C () +{ + check (this, this); +} +void C::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (5); + else if (this != base) + fail (6); + A::check (whole, static_cast (this)); + B::check (whole, static_cast (this)); +} + +struct D : virtual public A +{ + virtual ~D (); + D (); + virtual void check (void *whole, void *base); +}; +D::D () +{ + check (this, this); +} +D::~D () +{ + check (this, this); +} +void D::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (5); + else if (this != base) + fail (6); + A::check (whole, static_cast (this)); +} + +struct E : virtual public C, virtual public D +{ + virtual ~E (); + E (); + virtual void check (void *whole, void *base); +}; +E::E () +{ + check (this, this); +} +E::~E () +{ + check (this, this); +} +void E::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (5); + else if (this != base) + fail (6); + C::check (whole, static_cast (this)); + D::check (whole, static_cast (this)); +} + +struct F : virtual public E +{ + virtual ~F (); + F (); + virtual void check (void *whole, void *base); +}; +F::F () +{ + check (this, this); +} +F::~F () +{ + check (this, this); +} +void F::check (void *whole, void *base) +{ + if (dynamic_cast (this) != whole) + fail (5); + else if (this != base) + fail (6); + E::check (whole, static_cast (this)); +} + +int main () +{ + A a; + B b; + C c; + D d; + E e; + F f; + + return failed; +} -- cgit v1.2.3