]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tests
authorJason Merrill <jason@gcc.gnu.org>
Fri, 21 Nov 1997 04:04:33 +0000 (23:04 -0500)
committerJason Merrill <jason@gcc.gnu.org>
Fri, 21 Nov 1997 04:04:33 +0000 (23:04 -0500)
From-SVN: r16628

12 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++.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 9e7eb8a855fd47c3e2ec405dae3ce15821a13fee..3449eade6d16cb6b5e92e6187ae45f98f80453e8 100644 (file)
@@ -1,35 +1,2 @@
-// GROUPS passed operator-new
-#include <stdio.h>
-#include <stdlib.h>
-
-int pass = 0;
-
-void *operator new(size_t sz){
-
-  void *p;
-
-  pass = 1;
-  p = malloc(sz);
-  return p;
-}
-
-class A {
-public:
-  A() {}
-  ~A() {}
-
-  int a;
-  int b;
-};
-
-
-int main()
-{
-  A *bb = new A[10];
-  delete [] bb;
-
-  if (pass)
-    printf ("PASS\n");
-  else
-    printf ("FAIL\n");
-}
+#include <new>
+void *operator new(size_t sz) throw (std::bad_alloc) {
index 8d3f8fd81ac357b053f67f7b5b3db62c28d89586..efc2e8290df86ccb4cb02e50cd3533617e2ad4fb 100644 (file)
@@ -1,38 +1 @@
-// Build don't link: 
-// GROUPS passed visibility
-// Used to say:
-// manip.cc:17: member `_f' is a private member of class `B<int>'
-// manip.cc:17: member `_a' is a private member of class `B<int>'
-
-class A {};
-
-template <class TP>
-class B
-{
-  A &(*_f) (A &, TP);
-  TP _a;
-public:
-  B (A &(*f) (A &, TP), TP a) : _f (f), _a (a) {}
-  friend A &operator<< (A &o, const B<TP> &m);
-};
-
-template <class TP>
-inline A &
-operator<< (A &o, const B<TP> &m)
-{
-  (*m._f) (o, m._a);
-  return o;
-}
-
-A &setw (A &, int);
-B<int> setw (int n)
-{
-  return B<int> (setw, n);
-}
-
-A x;
-
-void f ()
-{
-  x << setw (2);
-}
+  friend A &operator<< <>(A &o, const B<TP> &m);
index 1a71ea5f3c531b6184b879e33b03c31b315ca14d..8fe928da7f4ff3bb999f610b32f124547c8b3a30 100644 (file)
@@ -1,25 +1,2 @@
-// Bug: new doesn't make sure that the count is an integral value.
-
-typedef __SIZE_TYPE__ size_t;
-extern "C" int printf (const char *, ...);
-extern "C" void *malloc (size_t);
-size_t s;
-
-void * operator new (size_t siz) {
-  if (s == 0)
-    s = siz;
-  else
-    s = (s != siz);
-  return malloc (siz);
-}
-
-main()
-{
-  s = 0;
-
-  float f = 3;
-  int* b1 = new int[(int)f];
-  int* b2 = new int[f];
-
-  return s;
-}
+#include <new>
+void * operator new (size_t siz) throw (std::bad_alloc) {
index 7d7aeee05b1afe7f83fbdd70abfe250a41104704..b055212efb024705bc4817f6782af7828486836c 100644 (file)
@@ -1,20 +1 @@
-// Build don't link: 
-// GROUPS passed overloading
-enum bar {};
-
-void operator+ (int, int);// ERROR - .*
-void operator+ (bar&, int);
-
-template <class T> void operator+ (int b, T& t) { return b; }
-void operator+ (int, bar&);
-
-template <class T> class foo
-{
-public:
-  friend void operator+ (int, T&);
-};
-
-class baz;
-
-class foo<int>;
-class foo<baz>;
+  friend void operator+ <> (int, T&);
index a2402fcd63e619108c4f9b46efb29768b4214d1e..87eb01454231c979541fb712e7c9edff46dac285 100644 (file)
@@ -1,21 +1 @@
-// PRMS Id: 4257 (second bug)
-// Bug: g++ fails to recognize multiple previous instantiations of a function
-// template.
-// Build don't link:
-
-template <class T>
-class A {
-  int i;
-
-  friend int foo (A<T>&);
-};
-
-template <class T> int foo (A<T>& a) { return a.i; }
-
-A<int> a;
-A<char> dummy;
-
-void bar ()
-{
-  foo (a);                     // gets bogus error - two foo(A<int>&)'s
-}
+// Special g++ Options: -fguiding-decls
index 35841f64712d2460fda4f6cde41686be783e81b5..64fff92d04f830e8f4a42f5e39c9e60de7e82165 100644 (file)
@@ -1,26 +1 @@
-// Bug: member operator shadows global template in tsubst.
-// Build don't link:
-
-class ostream;
-
-template <class TP> class smanip {
-public:
-  friend ostream& operator<<(ostream &o, const smanip<TP>&m);
-};
-
-template<class TP>
-ostream& operator<<(ostream& o, const smanip<TP>& m)
-{ return o;}
-
-class X
-{
-public:
-  X operator<<(int);  // commenting out this line makes it work!
-  void print(ostream& os);
-};
-
-void X::print(ostream& os)
-{
-  smanip<double> smd;
-  os << smd;                   // gets bogus error
-}
+  friend ostream& operator<< <>(ostream &o, const smanip<TP>&m);
index 2c26ad6753155a76c7fe2c2cf621807618738390..1e3830ada72525f7f9b1c3fba2cd3d6d3026e4ab 100644 (file)
@@ -1,17 +1,2 @@
-// Build don't link: 
-// GROUPS passed friends
-// friends file
-// From: rwave!myersn%rwave.roguewave@cs.orst.edu (Nathan Myers)
-// Date:     Thu, 17 Dec 92 16:33 PST
-// Subject:  2.3.2: friend decl of new confuses constructor
-// Message-ID: <m0n2Vec-0000GrC@rwave.roguewave.com>
-
-#include <stddef.h>
-struct Foo {
-  friend void* operator new(size_t);
-  friend void operator delete(void*) throw ();
-  Foo();
-  ~Foo();
-};
-Foo::Foo() { }
-Foo::~Foo() { }
+#include <new>
+  friend void* operator new(size_t) throw (std::bad_alloc);
index 1813a43814fcce8096c3b09533016d5ca8f485d8..b5c09370dfa7bc691c28dcd7246d82dadd97246f 100644 (file)
@@ -1,15 +1,2 @@
-#include <iostream.h>
-#include <stddef.h>
-
-int fail = 1;
-
-static void *operator new(size_t size) {
-  --fail;
-  return (void*) 0;
-}
-
-main() {
-  cout << "";
-  new int;
-  return fail;
-}
+#include <new>
+static void *operator new(size_t size) throw (std::bad_alloc) {
index e01fc64e8ce6fd378576af58eb3d78e7e8a73ba6..cf0c289e8c148d15d21a859fa7bd86c4188505f1 100644 (file)
@@ -1,17 +1,2 @@
-// It checks to see if you can define your own global new operator.
-// prms-id: 755
-
-typedef __SIZE_TYPE__ size_t;
-extern "C" void exit(int);
-
-void* operator new(size_t sz) {
-  void* p = 0;
-  exit(0);
-  return p;
-}
-
-main () {
-  int* i = new int;
-  delete i;
-  return 1;
-}
+#include <new>
+void* operator new(size_t sz) throw (std::bad_alloc) {
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()
+{
+}