OSDN Git Service

tests
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Nov 1997 04:05:13 +0000 (04:05 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 21 Nov 1997 04:05:13 +0000 (04:05 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@16629 138bc75d-0d04-0410-961f-82ee72b054a4

18 files changed:
gcc/testsuite/g++.old-deja/g++.brendan/new3.C
gcc/testsuite/g++.old-deja/g++.brendan/visibility3.C
gcc/testsuite/g++.old-deja/g++.eh/pdel1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.eh/pdel2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.eh/spec1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.eh/spec2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.eh/spec3.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.eh/spec4.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.jason/new.C
gcc/testsuite/g++.old-deja/g++.jason/overload.C
gcc/testsuite/g++.old-deja/g++.jason/overload10.C
gcc/testsuite/g++.old-deja/g++.jason/template10.C
gcc/testsuite/g++.old-deja/g++.law/friend1.C
gcc/testsuite/g++.old-deja/g++.mike/net46.C
gcc/testsuite/g++.old-deja/g++.mike/p755.C
gcc/testsuite/g++.old-deja/g++.pt/typename4.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/typename5.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/typename6.C [new file with mode: 0644]

index 9e7eb8a..5f5c988 100644 (file)
@@ -1,10 +1,11 @@
 // GROUPS passed operator-new
 #include <stdio.h>
 #include <stdlib.h>
+#include <new>
 
 int pass = 0;
 
-void *operator new(size_t sz){
+void *operator new(size_t sz) throw (std::bad_alloc) {
 
   void *p;
 
index 8d3f8fd..6e84da5 100644 (file)
@@ -13,7 +13,7 @@ class B
   TP _a;
 public:
   B (A &(*f) (A &, TP), TP a) : _f (f), _a (a) {}
-  friend A &operator<< (A &o, const B<TP> &m);
+  friend A &operator<< <>(A &o, const B<TP> &m);
 };
 
 template <class TP>
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/pdel1.C b/gcc/testsuite/g++.old-deja/g++.eh/pdel1.C
new file mode 100644 (file)
index 0000000..b30b402
--- /dev/null
@@ -0,0 +1,22 @@
+// Test for calling placement delete.
+
+#include <new>
+#include <stddef.h>
+
+int r = 1;
+
+struct A {
+  A() { throw 1; }
+  void operator delete (void *p, int, int) { r = 0; ::operator delete (p); }
+};
+
+void * operator new (size_t size, int, int) { return operator new (size); }
+
+main ()
+{
+  try {
+    A* ap = new (1, 5) A;
+  } catch (...) {  }
+
+  return r;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/pdel2.C b/gcc/testsuite/g++.old-deja/g++.eh/pdel2.C
new file mode 100644 (file)
index 0000000..c9b9bd1
--- /dev/null
@@ -0,0 +1,22 @@
+// Test for not calling mismatched placement delete.
+
+#include <new>
+#include <stddef.h>
+
+int r = 0;
+
+struct A {
+  A() { throw 1; }
+  void operator delete (void *p, int, long) { r = 1; ::operator delete (p); }
+};
+
+void * operator new (size_t size, int, int) { return operator new (size); }
+
+main ()
+{
+  try {
+    A* ap = new (1, 5) A;
+  } catch (...) {  }
+
+  return r;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec1.C b/gcc/testsuite/g++.old-deja/g++.eh/spec1.C
new file mode 100644 (file)
index 0000000..73ee960
--- /dev/null
@@ -0,0 +1,38 @@
+// Testing exception specifications.
+// Test 1: the original exception succeeds.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (1); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (char, int, bad_exception)
+{
+  throw 'a';
+}
+
+main ()
+{
+  set_terminate (my_term);
+  set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 0;
+    }
+  catch (int)
+    {
+      return 3;
+    }
+  catch (bad_exception)
+    {
+      return 4;
+    }
+  return 5;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec2.C b/gcc/testsuite/g++.old-deja/g++.eh/spec2.C
new file mode 100644 (file)
index 0000000..4401377
--- /dev/null
@@ -0,0 +1,38 @@
+// Testing exception specifications.
+// Test 2: the second throw succeeds.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (1); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (int, bad_exception)
+{
+  throw 'a';
+}
+
+main ()
+{
+  set_terminate (my_term);
+  set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 2;
+    }
+  catch (int)
+    {
+      return 0;
+    }
+  catch (bad_exception)
+    {
+      return 4;
+    }
+  return 5;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec3.C b/gcc/testsuite/g++.old-deja/g++.eh/spec3.C
new file mode 100644 (file)
index 0000000..148be76
--- /dev/null
@@ -0,0 +1,38 @@
+// Testing exception specifications.
+// Test 3: the bad_exception throw succeeds.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (1); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (bad_exception)
+{
+  throw 'a';
+}
+
+main ()
+{
+  set_terminate (my_term);
+  set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 2;
+    }
+  catch (int)
+    {
+      return 3;
+    }
+  catch (bad_exception)
+    {
+      return 0;
+    }
+  return 5;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/spec4.C b/gcc/testsuite/g++.old-deja/g++.eh/spec4.C
new file mode 100644 (file)
index 0000000..d8b8ce7
--- /dev/null
@@ -0,0 +1,38 @@
+// Testing exception specifications.
+// Test 4: all throws fail, call terminate.
+
+#include <stdlib.h>
+#include <exception>
+
+void my_term ()  { exit (0); }
+void my_unexp () { throw 42; }
+
+void
+f () throw (short)
+{
+  throw 'a';
+}
+
+main ()
+{
+  set_terminate (my_term);
+  set_unexpected (my_unexp);
+
+  try
+    {
+      f ();
+    }
+  catch (char)
+    {
+      return 2;
+    }
+  catch (int)
+    {
+      return 3;
+    }
+  catch (bad_exception)
+    {
+      return 4;
+    }
+  return 5;
+}
index 1a71ea5..0ac2562 100644 (file)
@@ -1,11 +1,11 @@
 // Bug: new doesn't make sure that the count is an integral value.
 
-typedef __SIZE_TYPE__ size_t;
+#include <new>
 extern "C" int printf (const char *, ...);
 extern "C" void *malloc (size_t);
 size_t s;
 
-void * operator new (size_t siz) {
+void * operator new (size_t siz) throw (std::bad_alloc) {
   if (s == 0)
     s = siz;
   else
index 7d7aeee..bc41672 100644 (file)
@@ -11,7 +11,7 @@ void operator+ (int, bar&);
 template <class T> class foo
 {
 public:
-  friend void operator+ (int, T&);
+  friend void operator+ <> (int, T&);
 };
 
 class baz;
index a2402fc..cd18382 100644 (file)
@@ -2,6 +2,7 @@
 // Bug: g++ fails to recognize multiple previous instantiations of a function
 // template.
 // Build don't link:
+// Special g++ Options: -fguiding-decls
 
 template <class T>
 class A {
index 35841f6..18a574a 100644 (file)
@@ -5,7 +5,7 @@ class ostream;
 
 template <class TP> class smanip {
 public:
-  friend ostream& operator<<(ostream &o, const smanip<TP>&m);
+  friend ostream& operator<< <>(ostream &o, const smanip<TP>&m);
 };
 
 template<class TP>
index 2c26ad6..5628e0b 100644 (file)
@@ -7,8 +7,9 @@
 // Message-ID: <m0n2Vec-0000GrC@rwave.roguewave.com>
 
 #include <stddef.h>
+#include <new>
 struct Foo {
-  friend void* operator new(size_t);
+  friend void* operator new(size_t) throw (std::bad_alloc);
   friend void operator delete(void*) throw ();
   Foo();
   ~Foo();
index 1813a43..235cbfb 100644 (file)
@@ -1,9 +1,10 @@
 #include <iostream.h>
 #include <stddef.h>
+#include <new>
 
 int fail = 1;
 
-static void *operator new(size_t size) {
+static void *operator new(size_t size) throw (std::bad_alloc) {
   --fail;
   return (void*) 0;
 }
index e01fc64..9dbebff 100644 (file)
@@ -1,10 +1,10 @@
 // It checks to see if you can define your own global new operator.
 // prms-id: 755
 
-typedef __SIZE_TYPE__ size_t;
+#include <new>
 extern "C" void exit(int);
 
-void* operator new(size_t sz) {
+void* operator new(size_t sz) throw (std::bad_alloc) {
   void* p = 0;
   exit(0);
   return p;
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename4.C b/gcc/testsuite/g++.old-deja/g++.pt/typename4.C
new file mode 100644 (file)
index 0000000..67ac939
--- /dev/null
@@ -0,0 +1,26 @@
+// Build don't link:
+
+template <class T>
+struct A
+{
+  typedef T A_Type;
+};
+
+
+template <class U>
+struct B : public A<U>
+{
+};
+
+
+template <class U>
+struct C : public B<U>
+{
+  A_Type Func();
+};
+
+
+template <class U>
+C<U>::A_Type C<U>::Func()
+{
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename5.C b/gcc/testsuite/g++.old-deja/g++.pt/typename5.C
new file mode 100644 (file)
index 0000000..202dadf
--- /dev/null
@@ -0,0 +1,26 @@
+// Build don't link:
+
+template <class T>
+struct A
+{
+  typedef T A_Type;
+};
+
+
+template <class U>
+struct B : public A<U>
+{
+};
+
+
+template <class U>
+struct C : public B<U>
+{
+  void Func(A_Type);
+};
+
+
+template <class U>
+void C<U>::Func(A_Type)
+{
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename6.C b/gcc/testsuite/g++.old-deja/g++.pt/typename6.C
new file mode 100644 (file)
index 0000000..4a8f05b
--- /dev/null
@@ -0,0 +1,20 @@
+// Build don't link:
+
+template <class T>
+struct A
+{
+  typedef T A_Type;
+};
+
+
+template <class U>
+struct B : public A<U>
+{
+  A_Type Func();
+};
+
+
+template <class U>
+A<U>::A_Type B<U>::Func()
+{
+}