diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 013bdd693b2..8cb182da8b4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,10 @@ +1999-11-22 Nathan Sidwell + + * g++.old-deja/g++.eh/cleanup2.C: New test. + * g++.old-deja/g++.ext/pretty2.C: New test. + * g++.old-deja/g++.ext/pretty3.C: New test. + * g++.old-deja/g++.other/debug6.C: New test. + 1999-11-19 Geoffrey Keating * gcc.c-torture/execute/991118-1.c: Also test case diff --git a/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C b/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C new file mode 100644 index 00000000000..08b3c5dc9c2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C @@ -0,0 +1,54 @@ +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// make sure we don't call base dtors, if we failed to call the +// base ctor due to exception throwing + +// execution test - XFAIL *-*-* + +#include + +static bool bad = false; + +static int thrower () +{ + printf ("in %s\n", __PRETTY_FUNCTION__); + throw 0; + return 0; +} + +struct X +{ + X (int) throw (int); + ~X () throw (); +}; + +X::X (int) throw (int) + {printf ("in ctor X %s\n", __PRETTY_FUNCTION__); bad = true;} +X::~X () throw () + {printf ("in dtor X %s\n", __PRETTY_FUNCTION__); bad = true;} + +struct X1 {}; +struct Y : X +{ + Y() throw (int); + ~Y() throw (); +}; +Y::Y() throw (int) + : X(thrower ()) // throws, so X::X is never called + {printf ("in ctor Y%s\n", __PRETTY_FUNCTION__); bad = true;} +Y::~Y() throw () + {printf ("in dtor Y%s\n", __PRETTY_FUNCTION__); bad = true;} + +int main () +{ + try + { + Y y; + } + catch (...) + { + printf ("caught\n"); + } + return bad; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/pretty2.C b/gcc/testsuite/g++.old-deja/g++.ext/pretty2.C new file mode 100644 index 00000000000..14eb5276ef5 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/pretty2.C @@ -0,0 +1,88 @@ +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in member functions + +// execution test - XFAIL *-*-* + +#include +#include + +static bool bad = false; + +struct X +{ + X (); + ~X (); + void fn (); + operator int (); +}; + +X::X () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("ctor\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "X")) + bad = true; + if (strcmp (pretty, "X::X ()")) + bad = true; +} +X::~X () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("dtor\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "X")) + bad = true; + if (strcmp (pretty, "X::~X ()")) + bad = true; +} +void X::fn () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("member fn\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "fn")) + bad = true; + if (strcmp (pretty, "void X::fn ()")) + bad = true; +} +X::operator int () +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("conversion\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "__opi")) + bad = true; + if (strcmp (pretty, "X::operator int ()")) + bad = true; + return 0; +} + +int main () +{ + { + X x; + + x.fn (); + (void)int (x); + } + return bad; +} diff --git a/gcc/testsuite/g++.old-deja/g++.ext/pretty3.C b/gcc/testsuite/g++.old-deja/g++.ext/pretty3.C new file mode 100644 index 00000000000..148b3badd6f --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.ext/pretty3.C @@ -0,0 +1,48 @@ +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in templates + +// execution test - XFAIL *-*-* + +#include +#include + +static bool bad = false; + +template void f1 (T) +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("generic\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "f1")) + bad = true; + if (strcmp (pretty, "void f1 (float)")) // only for float instantiation + bad = true; +} + +template<> void f1 (int) +{ + char const *function = __FUNCTION__; + char const *pretty = __PRETTY_FUNCTION__; + + printf ("specialized\n"); + printf ("__FUNCTION__ %s\n", function); + printf ("__PRETTY_FUNCTION__ %s\n", pretty); + + if (strcmp (function, "f1")) + bad = true; + if (strcmp (pretty, "void f1 (int)")) + bad = true; +} + +int main () +{ + f1(0); // f1 + f1(0.0f); // f1 + return bad; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/debug6.C b/gcc/testsuite/g++.old-deja/g++.other/debug6.C new file mode 100644 index 00000000000..8fd5f9f0ecf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/debug6.C @@ -0,0 +1,26 @@ +// Build don't link: +// Special g++ Options: -g -O2 + +// Copyright (C) 1999 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 21 Nov 1999 + +// This causes assember relocation errors + +// excess errors test - XFAIL *-*-* + +struct X +{ + virtual ~X () {} +}; + +struct Y +{ + Y (){}; +}; + +void foo () +{ + X *x = new X; + x->~X (); + Y ys[2]; +}