OSDN Git Service

new tests
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Nov 1997 06:38:34 +0000 (06:38 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 11 Nov 1997 06:38:34 +0000 (06:38 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@16426 138bc75d-0d04-0410-961f-82ee72b054a4

29 files changed:
gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.jason/inline3.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.jason/overload36.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.jason/pmf9.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.jason/template44.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.mike/virt6.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit50.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit51.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit52.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit53.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit54.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit55.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit56.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit57.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit58.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit59.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit60.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit61.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit62.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit63.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit64.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit65.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/partial1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/typedef1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/typename3.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/unify1.C [new file with mode: 0644]

diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow1.C
new file mode 100644 (file)
index 0000000..ef4dcb4
--- /dev/null
@@ -0,0 +1,45 @@
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+       {
+         printf ("Throwing 1...\n");
+         throw A();
+       }
+      catch (A)
+       {
+         try
+           {
+             printf ("Throwing 2...\n");
+             throw A();
+           }
+         catch (A)
+           {
+             printf ("Throwing 3...\n");
+             throw;
+           }
+       }
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow2.C
new file mode 100644 (file)
index 0000000..2d2583b
--- /dev/null
@@ -0,0 +1,45 @@
+// Testcase for proper handling of rethrow.
+
+#include <stdio.h>
+
+int c, d;
+
+struct A
+{
+  int i;
+  A () { i = ++c; printf ("A() %d\n", i); }
+  A (const A&) { i = ++c; printf ("A(const A&) %d\n", i); }
+  ~A() { printf ("~A() %d\n", i); ++d; }
+};
+
+int
+main ()
+{
+  try
+    {
+      try
+       {
+         printf ("Throwing 1...\n");
+         throw A();
+       }
+      catch (A)
+       {
+         try
+           {
+             printf ("Throwing 2...\n");
+             throw;
+           }
+         catch (A)
+           {
+             printf ("Throwing 3...\n");
+             throw;
+           }
+       }
+    }
+  catch (A)
+    {
+      printf ("Caught.\n");
+    }
+  printf ("c == %d, d == %d\n", c, d);
+  return c != d;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C b/gcc/testsuite/g++.old-deja/g++.eh/rethrow3.C
new file mode 100644 (file)
index 0000000..355bedc
--- /dev/null
@@ -0,0 +1,38 @@
+#include <stdio.h>
+#include <exception>
+
+static void
+eh_terminate ()
+{
+  printf ("CALLING TERMINATE\n");
+  exit (1);
+}
+
+void
+eh_test (int level)
+{
+  try
+    {
+      if (level < 2)
+       eh_test (level + 1);
+      else
+       {
+         printf ("%d: Throwing\n", level);
+         throw (level);
+       }
+    }
+  catch (int &x)
+    {
+      printf ("%d: Got level %d\n",
+             level, x);
+
+      if (level > 0)
+       throw;
+    }
+}
+
+main ()
+{
+  set_terminate (&eh_terminate);
+  eh_test (0);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/inline3.C b/gcc/testsuite/g++.old-deja/g++.jason/inline3.C
new file mode 100644 (file)
index 0000000..00d57eb
--- /dev/null
@@ -0,0 +1,42 @@
+// Testcase for order of destruction.
+// Special g++ Options: -O2
+
+extern "C" int printf( char const*, ... );
+int c;
+int r;
+
+struct B {
+  B();
+  B( B const& );
+  ~B();
+};
+
+struct A {
+  A();
+  A( A const& );
+  ~A();
+  operator B ();
+};
+
+inline A::operator B () { printf( "operator B ()\n"); return B(); }
+
+A f();
+void g( B const& );
+
+int
+main()
+{
+  g( f() );
+  return r;
+}
+
+B::B() { printf( "B::B()\n" ); if (++c != 2) r = 1; }
+B::B( B const& ) { printf( "B::B( B const& )\n" ); r = 1; }
+B::~B() { printf( "B::~B()\n" ); if (--c != 1) r = 1; }
+
+A::A() { printf( "A::A()\n" ); if (++c != 1) r = 1; }
+A::A( A const& ) { printf( "A::A( A const& )\n" ); r = 1; }
+A::~A() { printf( "A::~A()\n" ); if (--c != 0) r = 1; }
+
+A f() { printf( "f()\n"); return A(); }
+void g( B const& ) { printf( "g()\n"); }
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/overload36.C b/gcc/testsuite/g++.old-deja/g++.jason/overload36.C
new file mode 100644 (file)
index 0000000..f5e6fb6
--- /dev/null
@@ -0,0 +1,15 @@
+// Test for subsequence checking in overload resolution.
+
+class foo {
+public:
+  void operator <<(char *) { }
+  void operator <<(const char * const &);
+};
+int
+main()
+{
+  char s[20];
+  foo f;
+  f << s;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/pmf9.C b/gcc/testsuite/g++.old-deja/g++.jason/pmf9.C
new file mode 100644 (file)
index 0000000..335cfcc
--- /dev/null
@@ -0,0 +1,57 @@
+// PRMS id: g++/13340
+// Build don't link:
+
+class rectangle {
+    
+public:
+  rectangle();
+  int overlaps() const;
+
+};
+
+class region 
+{
+  friend class region_impl;
+
+public:
+  region();
+  typedef int (region::* region_func)() const;      
+
+};
+
+class region_impl  {
+  friend class region;
+
+private:
+  rectangle content, mbb;
+  region_impl *link_p;
+  region_impl(const rectangle &content);
+
+public:
+  int iterate(region *region_p, region::region_func what,
+             const rectangle &clip_rect) const;
+  int iterate(region *region_p, region::region_func what,
+             const region_impl &clip_rgn) const;
+};
+
+
+int
+region_impl::iterate (region *region_p, region::region_func what, 
+                     const rectangle &clip_rect) const
+{
+  for (const region_impl *p = this; p != 0 && p->mbb.overlaps();
+       p = p->link_p)
+    if (p->content.overlaps())
+      if (!(region_p->*what)()) return 0;
+  return 1;
+}
+
+int
+region_impl::iterate (region *region_p, region::region_func what,
+                     const region_impl &clip_rgn) const
+{
+  for (const region_impl *p = this; p != 0 && p->mbb.overlaps();
+       p = p->link_p)
+    if (!clip_rgn.iterate(region_p, what, p->content)) return 0;
+  return 1;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.jason/template44.C b/gcc/testsuite/g++.old-deja/g++.jason/template44.C
new file mode 100644 (file)
index 0000000..93b47bd
--- /dev/null
@@ -0,0 +1,61 @@
+#include <stdlib.h>
+#include <string.h>
+
+template <class T>
+class List {
+public:
+    int len;
+    T *array;
+
+    int length() const { return( len ); }
+
+    List() : len( 0 ), array( 0 ) {}
+};
+
+template <class T>
+int AlgoStdCompare(const T* a, const T* b) {
+  if (*a < *b)
+    return -1;
+  else
+    return (*a > *b);  // 0 if equal, 1 if greater
+}
+
+int AlgoStdCompare(const char* const* a, const char * const*b)
+{
+    return strcmp(*a,*b);
+}
+     
+template <class T>
+void AlgoFixupSort(List< T >* , int, int ) {
+}
+
+template <class T> 
+void AlgoSort(int (*compare)(const T *, const T *),
+         void (*fixup)( List<T> *, int first, int last),
+         List< T >* theList, int first, int last) {
+  if (last < 0)
+    last = theList->length()-1;
+  
+  qsort(theList->array+first, last-first+1, sizeof(T),
+       (int (*)(const void *, const void *))compare);
+  if (fixup)
+    fixup(theList, first, last);
+}
+
+template <class T> 
+void AlgoSort(List< T >* theList, int first = 0, int last = -1) {
+  int (*compare)(const T*, const T*) = AlgoStdCompare;
+  void (*fixup)( List<T> *, int first, int last) = AlgoFixupSort;
+  
+  AlgoSort(compare, fixup, theList, first, last);
+}
+
+int
+main()
+{
+    List<const char *> slist;
+    AlgoSort( &slist );
+
+    List<int> ilist;
+    AlgoSort( &ilist );
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/virt6.C b/gcc/testsuite/g++.old-deja/g++.mike/virt6.C
new file mode 100644 (file)
index 0000000..61491ce
--- /dev/null
@@ -0,0 +1,39 @@
+// This testcase ensures that we can build vtable names for complex MI
+// classes.
+
+class C_A {
+public:
+  virtual int foo(void *) { }
+} a;
+class C_B : public C_A {
+} b;
+class C_C : public C_A {
+} c;
+class C_D : public C_A {
+} d;
+class C_E : public C_C, public C_B {
+public:
+  virtual int foo(void *) { }
+} e;
+class C_F : public C_D, public C_B {
+public:
+  virtual int foo(void *) { }
+} f;
+class C_G : public C_A {
+public:
+  virtual int foo(void *) { }
+} g;
+class C_H : public C_G, public C_E, public C_F {
+public:
+  virtual int foo(void *) { }
+} h;
+int main() {
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit50.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit50.C
new file mode 100644 (file)
index 0000000..8c424cc
--- /dev/null
@@ -0,0 +1,15 @@
+extern "C" void abort ();
+
+template <class T> int f ()
+{
+  return sizeof(T);
+}
+
+int main ()
+{
+  if (f<long> () != sizeof(long)
+      || f<char> () != sizeof(char)
+      || f<long> () != sizeof(long)
+      || f<long int> () != sizeof(long int))
+    abort ();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit51.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit51.C
new file mode 100644 (file)
index 0000000..e4a0a64
--- /dev/null
@@ -0,0 +1,18 @@
+extern "C" void abort ();
+
+template <int a> int fact ()
+{
+  return 0;
+}
+
+template <> int fact<1> ()
+{
+  return 1;
+}
+
+int main()
+{
+  if (fact<3> () != 0 || fact<1> () != 1
+      || fact<3> () != 0 || fact<1> () != 1 || fact<1+0> () != 1)
+    abort ();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit52.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit52.C
new file mode 100644 (file)
index 0000000..368573e
--- /dev/null
@@ -0,0 +1,18 @@
+extern "C" void abort ();
+
+template <int a> inline int fact ()
+{
+  return a * fact<a-1> ();
+}
+
+template <> inline int fact<1> ()
+{
+  return 1;
+}
+
+int main()
+{
+  if (fact<3> () != 6 || fact<1> () != 1
+      || fact<3> () != 6 || fact<1> () != 1 || fact<1+0> () != 1)
+    abort ();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit53.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit53.C
new file mode 100644 (file)
index 0000000..e66cca9
--- /dev/null
@@ -0,0 +1,21 @@
+extern "C" void abort ();
+
+template <int a> inline int fact ();
+template <> inline int fact<1> ();
+
+template <int a> inline int fact ()
+{
+  return a * fact<a-1> ();
+}
+
+template <> inline int fact<1> ()
+{
+  return 1;
+}
+
+int main()
+{
+  if (fact<3> () != 6 || fact<1> () != 1
+      || fact<3> () != 6 || fact<1> () != 1 || fact<1+0> () != 1)
+    abort ();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit54.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit54.C
new file mode 100644 (file)
index 0000000..9d185be
--- /dev/null
@@ -0,0 +1,35 @@
+extern "C" void abort ();
+
+template <int a> inline int fact2 ();
+
+template <int a> inline int fact ()
+{
+  return a * fact2<a-1> ();
+}
+
+template <> inline int fact<1> ()
+{
+  return 1;
+}
+
+template <int a> inline int fact2 ()
+{
+  return a*fact<a-1>();
+}
+
+template <> inline int fact2<1> ()
+{
+  return 1;
+}
+
+int main()
+{
+  if (fact<3> () != 6 || fact<1> () != 1
+      || fact<3> () != 6 || fact<1> () != 1 || fact<1+0> () != 1)
+    abort ();
+  if (fact2<3> () != 6 || fact2<1> () != 1
+      || fact2<3> () != 6 || fact2<1> () != 1 || fact2<1+0> () != 1)
+    abort ();
+  if (fact2<4> () != 24 || fact<4> () != 24)
+    abort ();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit55.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit55.C
new file mode 100644 (file)
index 0000000..c9d3125
--- /dev/null
@@ -0,0 +1,14 @@
+template <class T> T* create ()
+{
+  return new T;
+}
+
+template <class T> T* create2()
+{
+  return create<T>();
+}
+
+int main()
+{
+  int *p = create2<int>();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit56.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit56.C
new file mode 100644 (file)
index 0000000..d202160
--- /dev/null
@@ -0,0 +1,16 @@
+template <class T> T* create ();
+
+template <class T> T* create2()
+{
+  return create<T>();
+}
+
+template <class T> T* create ()
+{
+  return new T;
+}
+
+int main()
+{
+  int *p = create2<int>();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit57.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit57.C
new file mode 100644 (file)
index 0000000..d1f0ea8
--- /dev/null
@@ -0,0 +1,42 @@
+extern "C" void abort ();
+
+int a = 0;
+
+template <class T> void f ();
+template <class T> void g ()
+{
+  if (a)
+    abort ();
+}
+
+template <> void g<char> ()
+{
+}
+
+template <class T> class C
+{
+  public:
+    void ff () { f<T> (); }
+    void gg () { g<T> (); }
+};
+
+template <class T> void f ()
+{
+  if (a)
+    abort ();
+}
+
+template <> void f<char> ()
+{
+}
+
+int main ()
+{
+  C<int> c;
+  c.ff();
+  c.gg();
+  a = 1;
+  C<char> d;
+  d.ff();
+  d.gg();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit58.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit58.C
new file mode 100644 (file)
index 0000000..7193d2d
--- /dev/null
@@ -0,0 +1,41 @@
+extern "C" void abort ();
+
+template <class T> void f ();
+template <class T> void g ()
+{
+  abort ();
+}
+
+template <> void g<char> ()
+{
+  abort ();
+}
+
+template <class T> class C
+{
+  public:
+    template <class U> void f () {}
+    template <class U> void g () {}
+    void ff () { f<T> (); }
+    void gg () { g<T> (); }
+};
+
+template <class T> void f ()
+{
+  abort ();
+}
+
+template <> void f<char> ()
+{
+  abort ();
+}
+
+int main ()
+{
+  C<int> c;
+  c.ff();
+  c.gg();
+  C<char> d;
+  d.ff();
+  d.gg();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit59.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit59.C
new file mode 100644 (file)
index 0000000..847a80a
--- /dev/null
@@ -0,0 +1,41 @@
+extern "C" void abort ();
+
+template <class T> void f ();
+template <class T> void g ()
+{
+  abort ();
+}
+
+template <> void g<char> ()
+{
+  abort ();
+}
+
+template <class T> class C
+{
+  public:
+    void ff () { f<T> (); }
+    void gg () { g<T> (); }
+    template <class U> void f () {}
+    template <class U> void g () {}
+};
+
+template <class T> void f ()
+{
+  abort ();
+}
+
+template <> void f<char> ()
+{
+  abort ();
+}
+
+int main ()
+{
+  C<int> c;
+  c.ff();
+  c.gg();
+  C<char> d;
+  d.ff();
+  d.gg();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit60.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit60.C
new file mode 100644 (file)
index 0000000..5fda333
--- /dev/null
@@ -0,0 +1,43 @@
+extern "C" void abort ();
+
+template <class T> void f ();
+template <class T> void g ()
+{
+  abort ();
+}
+
+template <> void g<char> ()
+{
+  abort ();
+}
+
+template <class T> class C
+{
+  public:
+    void ff () { f<T> (); }
+    void gg () { g<T> (); }
+    template <class U> void f () {}
+    template <class U> void g () {}
+    template <class U> void f (int) { abort(); }
+    template <class U> void g (int) { abort(); }
+};
+
+template <class T> void f ()
+{
+  abort ();
+}
+
+template <> void f<char> ()
+{
+  abort ();
+}
+
+int main ()
+{
+  C<int> c;
+  c.ff();
+  c.gg();
+  C<char> d;
+  d.ff();
+  d.gg();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit61.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit61.C
new file mode 100644 (file)
index 0000000..69b7891
--- /dev/null
@@ -0,0 +1,43 @@
+extern "C" void abort ();
+
+template <class T> void f ();
+template <class T> void g ()
+{
+  abort ();
+}
+
+template <> void g<char> ()
+{
+  abort ();
+}
+
+template <class T> class C
+{
+  public:
+    void ff () { f<T> (0); }
+    void gg () { g<T> (1); }
+    template <class U> void f () { abort(); }
+    template <class U> void g () { abort(); }
+    template <class U> void f (int) {}
+    template <class U> void g (int) {}
+};
+
+template <class T> void f ()
+{
+  abort ();
+}
+
+template <> void f<char> ()
+{
+  abort ();
+}
+
+int main ()
+{
+  C<int> c;
+  c.ff();
+  c.gg();
+  C<char> d;
+  d.ff();
+  d.gg();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit62.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit62.C
new file mode 100644 (file)
index 0000000..5917ce0
--- /dev/null
@@ -0,0 +1,19 @@
+extern "C" void abort ();
+
+template <class T> void f ()
+{
+}
+
+
+template <class T> class C
+{
+  friend void f<char> ();
+  public:
+    void ff () { f<char> (); }
+};
+
+int main ()
+{
+  C<int> c;
+  c.ff();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit63.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit63.C
new file mode 100644 (file)
index 0000000..ce4d99a
--- /dev/null
@@ -0,0 +1,19 @@
+extern "C" void abort ();
+
+template <class T> void f ()
+{
+}
+
+
+template <class T> class C
+{
+  friend void f<T> ();
+  public:
+    void ff () { f<T> (); }
+};
+
+int main ()
+{
+  C<int> c;
+  c.ff();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit64.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit64.C
new file mode 100644 (file)
index 0000000..2208b30
--- /dev/null
@@ -0,0 +1,23 @@
+extern "C" void abort ();
+
+template <class T> void f ()
+{
+  abort ();
+}
+
+template <> void f<char> ()
+{
+}
+
+template <class T> class C
+{
+  friend void f<char> ();
+  public:
+    void ff () { f<char> (); }
+};
+
+int main ()
+{
+  C<int> c;
+  c.ff();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit65.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit65.C
new file mode 100644 (file)
index 0000000..a026e8e
--- /dev/null
@@ -0,0 +1,33 @@
+extern "C" void abort ();
+
+template <class T> void f ()
+{
+  abort ();
+}
+
+template <> void f<char> ()
+{
+  abort ();
+}
+
+template <class T> void f (int)
+{
+  abort ();
+}
+
+template <> void f<char> (int)
+{
+}
+
+template <class T> class C
+{
+  friend void f<char> (int);
+  public:
+    void ff () { f<char> (0); }
+};
+
+int main ()
+{
+  C<int> c;
+  c.ff();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp63.C
new file mode 100644 (file)
index 0000000..6b7fc8e
--- /dev/null
@@ -0,0 +1,13 @@
+template <class T> struct A {
+  template <class U> void f (U u);
+};
+
+A<int> a;
+
+template <class T> template <class U> void A<T>::f (U u) { }
+
+main()
+{
+  a.f (24);
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/partial1.C b/gcc/testsuite/g++.old-deja/g++.pt/partial1.C
new file mode 100644 (file)
index 0000000..7a92996
--- /dev/null
@@ -0,0 +1,26 @@
+template<class T_type, int N>
+class foo {
+public:
+  enum bar { z = 0 };
+};
+
+template<int N>
+class foo<double, N> {
+public:
+  enum bar { z = 1 };
+};
+
+template<class T_type>
+class foo<T_type, 2> {
+public:
+  enum bar { z = 2 };
+};
+
+int main()
+{
+    if ((foo<int,3>::z == 0) && (foo<double,3>::z == 1) 
+       && (foo<float,2>::z == 2))
+           return 0;
+    else
+        return 1;
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typedef1.C b/gcc/testsuite/g++.old-deja/g++.pt/typedef1.C
new file mode 100644 (file)
index 0000000..5de152e
--- /dev/null
@@ -0,0 +1,18 @@
+// Testcase for handling of typedef wierdness.
+// Build don't link:
+
+template <class T>
+class A
+{
+  typedef enum
+  {
+    foo
+  } B;
+
+  A (B b);
+};
+
+template <class T>
+A<T>::A (B b)
+{
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename3.C b/gcc/testsuite/g++.old-deja/g++.pt/typename3.C
new file mode 100644 (file)
index 0000000..13a1fcc
--- /dev/null
@@ -0,0 +1,17 @@
+// Build don't link:
+// GROUPS passed templates
+template <class T>
+struct bar { 
+  typedef typename T::baz baz;
+};
+
+template <class T>
+void foo(T)
+{
+  bar<T>::baz(); // ERROR - T is int.
+}
+
+void foobar()
+{
+  foo(3);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/unify1.C b/gcc/testsuite/g++.old-deja/g++.pt/unify1.C
new file mode 100644 (file)
index 0000000..283e2f5
--- /dev/null
@@ -0,0 +1,14 @@
+// Tests non-unification of parms that don't use template parms.
+// Build don't link:
+
+enum kind {a, b};
+
+class C { public: C () {} };
+
+template<class P>
+void f (P c, kind k) {}
+
+template<class P>
+void f (P c, P d, kind k) {}
+
+template void f (C c, C c, kind k);