cleanup2.C: New test.

* 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.

From-SVN: r30615
This commit is contained in:
Nathan Sidwell 1999-11-22 15:51:14 +00:00 committed by Nathan Sidwell
parent d3201a2ce6
commit 7cffd12d38
5 changed files with 223 additions and 0 deletions

View File

@ -1,3 +1,10 @@
1999-11-22 Nathan Sidwell <nathan@acm.org>
* 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 <geoffk@cygnus.com>
* gcc.c-torture/execute/991118-1.c: Also test case

View File

@ -0,0 +1,54 @@
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
// make sure we don't call base dtors, if we failed to call the
// base ctor due to exception throwing
// execution test - XFAIL *-*-*
#include <stdio.h>
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;
}

View File

@ -0,0 +1,88 @@
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in member functions
// execution test - XFAIL *-*-*
#include <stdio.h>
#include <string.h>
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;
}

View File

@ -0,0 +1,48 @@
// Copyright (C) 1999 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Nov 1999 <nathan@acm.org>
// make sure __FUNCTION__ and __PRETTY_FUNCTION__ work in templates
// execution test - XFAIL *-*-*
#include <stdio.h>
#include <string.h>
static bool bad = false;
template<class T> 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> (float)")) // only for float instantiation
bad = true;
}
template<> void f1<int> (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> (int)"))
bad = true;
}
int main ()
{
f1(0); // f1<int>
f1(0.0f); // f1<float>
return bad;
}

View File

@ -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 <nathan@acm.org>
// 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];
}