* g++.old-deja/g++.eh/cleanup2.C: New test.
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Nov 1999 15:51:14 +0000 (15:51 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 22 Nov 1999 15:51:14 +0000 (15:51 +0000)
* 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30615 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.old-deja/g++.eh/cleanup2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.ext/pretty2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.ext/pretty3.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.other/debug6.C [new file with mode: 0644]

index 013bdd6..8cb182d 100644 (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
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 (file)
index 0000000..08b3c5d
--- /dev/null
@@ -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;
+}
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 (file)
index 0000000..14eb527
--- /dev/null
@@ -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;
+}
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 (file)
index 0000000..148b3ba
--- /dev/null
@@ -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;
+}
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 (file)
index 0000000..8fd5f9f
--- /dev/null
@@ -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];
+}