diff --git a/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C b/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C
new file mode 100644
index 0000000000000000000000000000000000000000..ce373601ded33b51aabfa6e822045d1beecd6fca
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C
@@ -0,0 +1,20 @@
+// Bug: fold is too eager about pushing down CLEANUP_POINT_EXPR.
+
+int d;
+
+struct A {
+  A() { }
+  ~A() { d = 1; }
+};
+
+int f (const A& a)
+{
+  return 1;
+}
+
+main ()
+{
+  if (f (A()) && d == 0)
+    return 0;
+  return 1;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/overcnv1.C b/gcc/testsuite/g++.old-deja/g++.other/overcnv1.C
new file mode 100644
index 0000000000000000000000000000000000000000..05941df5ff0b03fbdbbcde14be3b65ee6f1c5902
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/overcnv1.C
@@ -0,0 +1,15 @@
+// Build don't link:
+
+class A {
+public:
+	void f(const char * const * );
+};
+void f(const char * const *) {}
+
+void g()
+{
+	char *ar[10];
+	A a;
+	f(ar);
+	a.f(ar);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/defarg2.C b/gcc/testsuite/g++.old-deja/g++.pt/defarg2.C
new file mode 100644
index 0000000000000000000000000000000000000000..444ecc40b50adfbb5670555f3481ad5b1ef858e1
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/defarg2.C
@@ -0,0 +1,17 @@
+template <int S=0, class T=int>
+struct X
+{};
+
+template <>
+struct X<0,int>
+{};
+
+template <int S>
+struct X<S,int>
+: X<>
+{};
+
+int main()
+{
+  X<1,int> x;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend1.C b/gcc/testsuite/g++.old-deja/g++.pt/friend1.C
new file mode 100644
index 0000000000000000000000000000000000000000..ba642ba5c5ae40b15a5d8ce9b23e2fefb8d08db3
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend1.C
@@ -0,0 +1,24 @@
+template <class T>
+void f(T);
+
+class C
+{
+  template <class T>
+  friend void f(T);
+
+  int i;
+};
+
+
+template <class T>
+void f(T)
+{
+  C c;
+  c.i = 3;
+}
+
+
+int main()
+{
+  f(7);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend10.C b/gcc/testsuite/g++.old-deja/g++.pt/friend10.C
new file mode 100644
index 0000000000000000000000000000000000000000..bff432b5620bd3dde5a18e5c1f6c540129c2551a
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend10.C
@@ -0,0 +1,29 @@
+template <class T>
+void f(T);
+
+template <class U>
+class C
+{
+  template <class T>
+  friend void f(T)
+    {
+      C<U> c;
+      c.i = 3;
+    }
+
+public:
+
+  void g()
+    {
+      f(3.0);
+    }
+
+  int i;
+};
+
+int main()
+{
+  f(7);
+  C<double> c;
+  c.g();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend11.C b/gcc/testsuite/g++.old-deja/g++.pt/friend11.C
new file mode 100644
index 0000000000000000000000000000000000000000..d70fae6e0c870f69de881e73d9734a5f8e808156
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend11.C
@@ -0,0 +1,31 @@
+template <class T>
+class C;
+
+template <class T>
+struct S
+{
+  template <class U>
+  void f(U u)
+    {
+      C<U> cu;
+      cu.i = 3; // ERROR - S<double>::f<U> is a friend, but this is
+                //         S<int>::f<double>. 
+    }
+};
+
+
+template <class T>
+class C
+{
+  template <class U>
+  friend void S<T>::f(U);
+
+  int i;
+};
+
+
+int main()
+{
+  S<int> si;
+  si.f(3.0);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend12.C b/gcc/testsuite/g++.old-deja/g++.pt/friend12.C
new file mode 100644
index 0000000000000000000000000000000000000000..ef9bfc8a02cd1397962005187567d4a78e13a7aa
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend12.C
@@ -0,0 +1,33 @@
+template <class T>
+class C;
+
+template <class T>
+struct S
+{
+  template <class U>
+  void f(U u1, U u2) {}
+
+  template <class U>
+  void f(U u)
+    {
+      C<T> ct;
+      ct.i = 3;
+    }
+};
+
+
+template <class T>
+class C
+{
+  template <class U>
+  friend void S<T>::f(U);
+
+  int i;
+};
+
+
+int main()
+{
+  S<int> si;
+  si.f(3.0);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend13.C b/gcc/testsuite/g++.old-deja/g++.pt/friend13.C
new file mode 100644
index 0000000000000000000000000000000000000000..251d52a47bc16594d6703c231b2bebccaa30c434
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend13.C
@@ -0,0 +1,33 @@
+template <class T>
+class C;
+
+template <class U>
+struct S
+{
+  template <class V>
+  void f(V v)
+    {
+      C<V> cv;
+      cv.i = 3;
+    }
+};
+
+
+template <class T>
+class C
+{
+  template <class U>
+  template <class V>
+  friend void S<U>::f(V);
+
+  int i;
+};
+
+
+int main()
+{
+  S<int> si;
+  si.f(3.0);
+  S<long> sl;
+  sl.f('c');
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend3.C b/gcc/testsuite/g++.old-deja/g++.pt/friend3.C
new file mode 100644
index 0000000000000000000000000000000000000000..77aabd3bee30e5da0474238d4a680ebd5f5c23ce
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend3.C
@@ -0,0 +1,25 @@
+// Build don't link:
+
+template <class T>
+void f(T);
+
+class C
+{
+  friend void f<>(double);
+
+  int i;
+};
+
+
+template <class T>
+void f(T)
+{
+  C c;
+  c.i = 3; // ERROR - f<double> is a friend, this is f<int>.
+}
+
+
+int main()
+{
+  f(7);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend4.C b/gcc/testsuite/g++.old-deja/g++.pt/friend4.C
new file mode 100644
index 0000000000000000000000000000000000000000..ea439277c5a9bbeec76065f7e75092a54415ed7c
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend4.C
@@ -0,0 +1,21 @@
+class C
+{
+  template <class T>
+  friend void f(T);
+
+  int i;
+};
+
+
+template <class T>
+void f(T)
+{
+  C c;
+  c.i = 3;
+}
+
+
+int main()
+{
+  f(7);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend5.C b/gcc/testsuite/g++.old-deja/g++.pt/friend5.C
new file mode 100644
index 0000000000000000000000000000000000000000..516be4dd018ccbc1b9d0dcce04ba5efd2c115b22
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend5.C
@@ -0,0 +1,17 @@
+class C
+{
+  template <class T>
+  friend void f(T)
+    {
+      C c;
+      c.i = 3;
+    }
+
+  int i;
+};
+
+
+int main()
+{
+  f(7);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend6.C b/gcc/testsuite/g++.old-deja/g++.pt/friend6.C
new file mode 100644
index 0000000000000000000000000000000000000000..5651421e6cfbe70648f2d4238fcfd4214fcb3236
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend6.C
@@ -0,0 +1,28 @@
+template <class T>
+void f(T);
+
+class C
+{
+  template <class T>
+  friend void f(T)
+    {
+      C c;
+      c.i = 3;
+    }
+
+public:
+
+  void g()
+    {
+      f(3.0);
+    }
+
+  int i;
+};
+
+int main()
+{
+  f(7);
+  C c;
+  c.g();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend7.C b/gcc/testsuite/g++.old-deja/g++.pt/friend7.C
new file mode 100644
index 0000000000000000000000000000000000000000..2962d9245314b4a35e4c2f16e41161f69a2c14df
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend7.C
@@ -0,0 +1,25 @@
+template <class T>
+void f(T);
+
+template <class U>
+class C
+{
+  template <class T>
+  friend void f(T);
+
+  int i;
+};
+
+
+template <class T>
+void f(T)
+{
+  C<T> c;
+  c.i = 3;
+}
+
+
+int main()
+{
+  f(7);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend8.C b/gcc/testsuite/g++.old-deja/g++.pt/friend8.C
new file mode 100644
index 0000000000000000000000000000000000000000..ffa9122728f34f1023b703b42ad0c23b4946a397
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend8.C
@@ -0,0 +1,18 @@
+template <class T>
+class C
+{
+  friend void f (C<T> c)
+    {
+      c.i = 3;
+    }
+
+  int i;
+};
+
+
+int main()
+{
+  C<int> ci;
+
+  f(ci);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/friend9.C b/gcc/testsuite/g++.old-deja/g++.pt/friend9.C
new file mode 100644
index 0000000000000000000000000000000000000000..63455d01a5250df7088b44396a96184a15257383
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/friend9.C
@@ -0,0 +1,22 @@
+template <class U>
+class C
+{
+  template <class T>
+  friend void f(T);
+
+  int i;
+};
+
+
+template <class T>
+void f(T)
+{
+  C<int> c;
+  c.i = 3;
+}
+
+
+int main()
+{
+  f(7);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate2.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate2.C
new file mode 100644
index 0000000000000000000000000000000000000000..a5c6c49d16f24aff815e6a0241a11524735318e9
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate2.C
@@ -0,0 +1,12 @@
+// Build don't link:
+
+template<class T>
+struct X_two {
+  template <class T2> T2 conv_compare_ge(T2 test) {
+    T2 tmp_value = T2 (0);
+    return (tmp_value > test ? tmp_value : test);
+  }
+};
+
+template int X_two<double>::conv_compare_ge(int);
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C
index a64adeb8817d3eb11be2ca8d45adb5c5f9f9103b..38c295388d01c293e660854382e2a268acd7b7df 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C
@@ -18,7 +18,8 @@ struct A {
     template<int N2, class T, int N3>
     static void f(B<N2,T>, B<N3,T> b)
     {
-        D<N2,N3,N>::E::f(b);
+        typedef typename D<N2,N3,N>::E E;
+	E::f(b);
     }
 };
 
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp70.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp70.C
new file mode 100644
index 0000000000000000000000000000000000000000..2a9fe8a2c3548130e66db989295ca5638303e6a8
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp70.C
@@ -0,0 +1,24 @@
+// Build don't link:
+
+template <class T>
+class X {
+public:
+  T x;
+};
+
+class Y {
+public:
+  template <class T> static void f(X<T>& a) {}
+
+  void g(void);
+};
+
+void
+Y::g(void)
+{
+  X<int> a;
+
+  f(a);
+}
+
+  
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/ttp42.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp42.C
new file mode 100644
index 0000000000000000000000000000000000000000..b2610dfb123b1bb1f1d8807672a8bdc8bffa6c21
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/ttp42.C
@@ -0,0 +1,21 @@
+template <class T, template <class T> class C>
+struct X
+{};
+
+template <class T>
+struct Y
+{};
+
+template <class T>
+struct Z
+{};
+
+template <class T>
+struct X<T,Y>
+{};
+
+int main()
+{
+  X<int,Y> a;
+  X<int,Z> b;
+}