aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@gcc.gnu.org>1998-01-19 19:57:39 -0500
committerJason Merrill <jason@gcc.gnu.org>1998-01-19 19:57:39 -0500
commita6475d981a93c26c665ae66278524bcc13c5852d (patch)
tree72d843a75d4a103f7a6f370927e21fbaa0103261
parent756506468674bd03d9a3b8fa25f8b33bd49878b3 (diff)
downloadgcc-a6475d981a93c26c665ae66278524bcc13c5852d.zip
gcc-a6475d981a93c26c665ae66278524bcc13c5852d.tar.gz
gcc-a6475d981a93c26c665ae66278524bcc13c5852d.tar.bz2
tests from mark
From-SVN: r17427
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/p5840.C10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/pt3.C3
-rw-r--r--gcc/testsuite/g++.old-deja/g++.mike/pt4.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/static1.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/bad-type.C19
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit32.C2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit34.C4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit38.C7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit39.C7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit40.C27
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit41.C8
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit42.C17
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/explicit43.C23
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/instantiate1.C22
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/local1.C21
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/local2.C20
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/local3.C22
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/local4.C25
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/local5.C24
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/memtemp28.C13
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/memtemp65.C23
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/memtemp66.C15
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/memtemp67.C19
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/recursion.C31
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/recursion2.C25
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec10.C26
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec11.C20
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec2.C27
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec3.C37
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec4.C16
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec5.C20
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec6.C29
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec7.C19
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec8.C27
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/spec9.C21
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/static_cast.C22
-rw-r--r--gcc/testsuite/g++.old-deja/g++.pt/typename3.C21
37 files changed, 660 insertions, 22 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/p5840.C b/gcc/testsuite/g++.old-deja/g++.mike/p5840.C
index 46a161b..53b9510 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/p5840.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/p5840.C
@@ -17,17 +17,19 @@ public:
int value (Foo* a) { return (a->*Id)(); }
};
-template class Bar <Derived, &Signal::Name>;
+/* The following line is illegal under the new rules for non-type
+ template arguments in the standard, so it is commented out. */
+/* template class Bar <Derived, &Signal::Name>; */
template class Bar <Signal, &Signal::Name>;
template class Bar <Derived, &Derived::Name>;
Derived a;
-Bar<Derived, &Signal::Name> dispatcher1;
+/* Bar<Derived, &Signal::Name> dispatcher1; */
Bar<Derived, &Derived::Name> dispatcher2;
main() {
- int i1 = dispatcher1.value(&a);
+ /* int i1 = dispatcher1.value(&a); */
int i2 = dispatcher2.value(&a);
- return i1 != 1 || i2 != 2;
+ return /* i1 != 1 || */ i2 != 2;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/pt3.C b/gcc/testsuite/g++.old-deja/g++.mike/pt3.C
index b2abc2bd..a61d902 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/pt3.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/pt3.C
@@ -15,11 +15,14 @@ syHandle<Repr>::~syHandle()
}
typedef char * char_ptr_t;
+
+template <>
syHandle<char_ptr_t>::syHandle()
{
_repr = 0;
}
+template <>
syHandle<char_ptr_t>::~syHandle()
{
_repr = 0;
diff --git a/gcc/testsuite/g++.old-deja/g++.mike/pt4.C b/gcc/testsuite/g++.old-deja/g++.mike/pt4.C
index 00e8ad0..7c1563e 100644
--- a/gcc/testsuite/g++.old-deja/g++.mike/pt4.C
+++ b/gcc/testsuite/g++.old-deja/g++.mike/pt4.C
@@ -1,4 +1,4 @@
// Build don't link:
template <char* c> struct B { B() { } };
-B<0> bnull;
+B<0> bnull; // ERROR - could not convert template argument
diff --git a/gcc/testsuite/g++.old-deja/g++.other/static1.C b/gcc/testsuite/g++.old-deja/g++.other/static1.C
new file mode 100644
index 0000000..c18e55c
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/static1.C
@@ -0,0 +1,8 @@
+extern "C" void abort();
+
+struct S
+{
+ static const int i = 3;
+};
+
+const int S::i = 2; // ERROR - duplicate initialization
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/bad-type.C b/gcc/testsuite/g++.old-deja/g++.pt/bad-type.C
new file mode 100644
index 0000000..6b22b86
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/bad-type.C
@@ -0,0 +1,19 @@
+template<class Type>
+class A
+{
+public:
+ Type m;
+};
+
+template<class Type>
+void f(A<Type>& a, Type d)
+{
+ A.m=d; // ERROR - invalid use of template
+}
+
+int main()
+{
+ A<int> a;
+ f(a,2);
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit32.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit32.C
index 7c0e285..5942fe7 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/explicit32.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit32.C
@@ -12,7 +12,7 @@ struct S<int>
void foo();
};
-template <>
+
void S<int>::foo()
{
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit34.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit34.C
index 40c1da0..487525e 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/explicit34.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit34.C
@@ -4,7 +4,7 @@ template <class T>
void foo(T t);
template <>
-void foo(int) {}; // ERROR - redefinition.
+void foo(int) {};
template <>
-void foo<int>(int) {} // ERROR - redefinition.
+void foo<int>(int) {} // ERROR - duplicate specialization.
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit38.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit38.C
new file mode 100644
index 0000000..27121b6
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit38.C
@@ -0,0 +1,7 @@
+template <int I>
+void f(int j);
+
+void g()
+{
+ f<7, 12>(3); // ERROR - no matching function.
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit39.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit39.C
new file mode 100644
index 0000000..906ef30
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit39.C
@@ -0,0 +1,7 @@
+template <class T>
+void f(int i);
+
+void g()
+{
+ f<7>(3); // ERROR - no matching function.
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit40.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit40.C
new file mode 100644
index 0000000..d237924
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit40.C
@@ -0,0 +1,27 @@
+extern "C" void abort();
+
+template <void* P>
+void f(int j);
+
+template <unsigned int I>
+void f(int j);
+
+
+template <void* P>
+void f(int j)
+{
+ abort();
+}
+
+
+template <unsigned int I>
+void f(int j)
+{
+}
+
+
+int main()
+{
+ f<3>(7);
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit41.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit41.C
new file mode 100644
index 0000000..b5ca475
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit41.C
@@ -0,0 +1,8 @@
+template <int I>
+void f(int i);
+
+void g()
+{
+ int i;
+ f<i>(7); // ERROR - template argument 1 is invalid.
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit42.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit42.C
new file mode 100644
index 0000000..c19ffd0
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit42.C
@@ -0,0 +1,17 @@
+extern "C" void abort(void);
+
+template <int I>
+void f(int i)
+{
+}
+
+template <void*>
+void f(int i)
+{
+ abort();
+}
+
+int main()
+{
+ f<0>(3);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit43.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit43.C
new file mode 100644
index 0000000..6396f09
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit43.C
@@ -0,0 +1,23 @@
+extern "C" void abort(void);
+
+void F(int)
+{
+}
+
+
+void F(double)
+{
+ abort();
+}
+
+template <void (*F)(int)>
+void g()
+{
+ (*F)(3);
+}
+
+
+int main()
+{
+ g<&F>();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/instantiate1.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate1.C
new file mode 100644
index 0000000..1d9c758
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/instantiate1.C
@@ -0,0 +1,22 @@
+// Build don't link:
+
+template <class T>
+void f(T t);
+
+template void f<int>(int);
+template void f<>(long);
+
+template <class T>
+struct S
+{
+ void bar(int) {}
+
+ template <class U>
+ void baz(U u) {}
+};
+
+
+template S<char>;
+template void S<int>::bar(int);
+template void S<double>::baz<short>(short);
+template void S<long>::baz<>(char);
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local1.C b/gcc/testsuite/g++.old-deja/g++.pt/local1.C
new file mode 100644
index 0000000..1b9e515
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/local1.C
@@ -0,0 +1,21 @@
+template <class STRUCT, class MEMBER> inline STRUCT *
+setback(MEMBER *bp, MEMBER STRUCT::*offset)
+{
+ if(!bp) return 0;
+ union { int i; MEMBER STRUCT::*of; } u;
+ u.of = offset;
+ return (STRUCT *) ((int) bp - u.i);
+}
+
+
+struct S
+{
+ int i;
+};
+
+int main()
+{
+ S s;
+
+ S* sp = setback (&s.i, &S::i);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local2.C b/gcc/testsuite/g++.old-deja/g++.pt/local2.C
new file mode 100644
index 0000000..4aafc69
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/local2.C
@@ -0,0 +1,20 @@
+extern "C" void abort();
+
+template <class T>
+void f(T)
+{
+ struct S {
+ int i;
+ } s;
+
+ s.i = 3;
+
+ if (s.i != 3)
+ abort();
+}
+
+
+int main()
+{
+ f(7);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local3.C b/gcc/testsuite/g++.old-deja/g++.pt/local3.C
new file mode 100644
index 0000000..58c2627
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/local3.C
@@ -0,0 +1,22 @@
+extern "C" void abort();
+
+template <class T>
+void f(T)
+{
+ struct S {
+ int i;
+ };
+
+ S s;
+
+ s.i = 3;
+
+ if (s.i != 3)
+ abort();
+}
+
+
+int main()
+{
+ f(7);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local4.C b/gcc/testsuite/g++.old-deja/g++.pt/local4.C
new file mode 100644
index 0000000..6a7eb341
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/local4.C
@@ -0,0 +1,25 @@
+extern "C" void abort();
+
+template <class T>
+struct S {};
+
+S<int> si;
+
+template <class T>
+int f(T t)
+{
+ struct S {
+ int g(int i) { return i + 2; }
+ };
+
+ S s;
+
+ return s.g(t) + s.g(t);
+}
+
+
+int main()
+{
+ if (f(3) != 10)
+ abort();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local5.C b/gcc/testsuite/g++.old-deja/g++.pt/local5.C
new file mode 100644
index 0000000..b49525c
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/local5.C
@@ -0,0 +1,24 @@
+template <class INT>
+class b
+{
+private:
+ char a(int x)
+ {
+ union {
+ int i;
+ char c;
+ } val;
+ val.i = x;
+ return val.c;
+ };
+
+public:
+ b() {
+ }
+};
+
+int main() {
+ b<int> n;
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp28.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp28.C
index ab3ce2d..37e79c8 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp28.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp28.C
@@ -1,17 +1,17 @@
-// Build don't run:
-// GROUPS passed templates membertemplates
-extern "C" int printf(const char*, ...);
+extern "C" void abort();
+
+int k;
template <class X>
struct S
{
template <class U>
void f(U u)
- { printf ("In S::f(U)\n"); g(u); }
+ { ++k; g(u); }
template <class U>
void g(U u)
- { printf ("In S::g(U)\n"); }
+ { ++k; }
int c[16];
};
@@ -21,4 +21,7 @@ int main()
S<char*> s;
s.f(3);
s.f("adf");
+
+ if (k != 4)
+ abort();
}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp65.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp65.C
new file mode 100644
index 0000000..ef49d84
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp65.C
@@ -0,0 +1,23 @@
+// Build don't link:
+
+template<unsigned int n> struct PartialDotProduct {
+ template<class T>
+ static T Expand(T* a, T* b) { return T(); }
+};
+
+const int N = 10;
+
+template<class In1, class In2>
+void
+dot(In1 f1, In2 f2)
+{
+ PartialDotProduct<N>::Expand(f1, f2);
+
+}
+
+int main()
+{
+ double a[N], b[N];
+
+ dot(&a[0], &b[0]);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp66.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp66.C
new file mode 100644
index 0000000..d7c1f57
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp66.C
@@ -0,0 +1,15 @@
+// Build don't link:
+
+template <class T>
+struct S
+{
+ template <class U>
+ void f(U u) { this->template f<>(3); }
+};
+
+
+void g()
+{
+ S<char> s;
+ s.f(1.0);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp67.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp67.C
new file mode 100644
index 0000000..bcf5960
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp67.C
@@ -0,0 +1,19 @@
+template <class T>
+struct A
+{
+ template <class T2>
+ operator A<T2>() const { return A<T2>(); }
+};
+
+main()
+{
+ A<int> a1;
+ A<long> a2;
+ A<double> a3;
+ A<char> a4;
+
+ a2 = a1.operator A<long>();
+ a3 = (A<double>) a1;
+ a4 = a1;
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/recursion.C b/gcc/testsuite/g++.old-deja/g++.pt/recursion.C
new file mode 100644
index 0000000..7efaeb0
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/recursion.C
@@ -0,0 +1,31 @@
+// Build don't link:
+
+const double M_PI=3.14159265358979323846;
+
+template<int N,int I,int J,int K>
+inline double SineSeries()
+{
+ const double x=I*2*M_PI/N;
+ const bool go=K+1!=J;
+ return 1.0-x*x/(2*K+2)/(2*K+3)*SineSeries<N*go,I*go,J*go,(K+1)*go>();
+}
+
+template<>
+inline double SineSeries<0,0,0,0>()
+{
+ return 1.0;
+}
+
+template<int N,int I>
+inline double Sine()
+{
+ const double x=(I*2*M_PI/N);
+ return x * SineSeries<N,I,10,0>();
+}
+
+int main()
+{
+ double f=Sine<32,5>();
+ return 0;
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/recursion2.C b/gcc/testsuite/g++.old-deja/g++.pt/recursion2.C
new file mode 100644
index 0000000..8cb3a2b
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/recursion2.C
@@ -0,0 +1,25 @@
+template< int i > struct T :
+public T< i-1 >
+{
+};
+
+template<> struct T< 0 >
+{
+};
+
+template< class F > struct T1 :
+public T< F::dim >
+{
+};
+
+template< int i > struct S
+{
+ enum { dim = i } ;
+};
+
+int main()
+{
+ T1< S< 4 > > t ;
+ return( 0 ) ;
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec10.C b/gcc/testsuite/g++.old-deja/g++.pt/spec10.C
new file mode 100644
index 0000000..10947aa
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec10.C
@@ -0,0 +1,26 @@
+extern "C" void abort();
+
+template <class T>
+struct S
+{
+ template <int i>
+ int f(int j) { abort(); return 0; }
+
+ template <>
+ int f<7>(int j) { return j + 7; }
+
+ template <>
+ int f<8>(int j) { return j + 8; }
+};
+
+
+int main()
+{
+ S<double> s;
+
+ if (s.template f<7>(3) != 10)
+ abort();
+
+ if (s.template f<8>(3) != 11)
+ abort();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec11.C b/gcc/testsuite/g++.old-deja/g++.pt/spec11.C
new file mode 100644
index 0000000..4369f18
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec11.C
@@ -0,0 +1,20 @@
+extern "C" void abort();
+
+template <class T>
+struct S
+{
+ template <class U>
+ int f(U u);
+};
+
+template <class T>
+template <>
+int S<T>::f(int i) { return 1; }
+
+int main()
+{
+ S<char> sc;
+
+ if (sc.f(3) != 1)
+ abort();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec2.C b/gcc/testsuite/g++.old-deja/g++.pt/spec2.C
new file mode 100644
index 0000000..338c69e
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec2.C
@@ -0,0 +1,27 @@
+// Build don't link:
+
+class X
+{
+ public:
+ virtual void f() const = 0;
+};
+
+template <class T>
+class Y: public X
+{
+ public:
+ virtual void f() const;
+};
+
+template <class T>
+void Y<T>::f() const
+{
+}
+
+template <>
+void Y<bool>::f() const;
+
+template <>
+void Y<bool>::f() const
+{
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec3.C b/gcc/testsuite/g++.old-deja/g++.pt/spec3.C
new file mode 100644
index 0000000..b0e710f
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec3.C
@@ -0,0 +1,37 @@
+extern "C" void abort();
+
+class X
+{
+ public:
+ virtual int f() const = 0;
+};
+
+template <class T>
+class Y: public X
+{
+ public:
+ virtual int f() const;
+};
+
+template <class T>
+int Y<T>::f() const
+{
+ abort();
+ return 0;
+}
+
+template <>
+int Y<bool>::f() const;
+
+template <>
+int Y<bool>::f() const
+{
+ return 0;
+}
+
+int main()
+{
+ Y<bool> yb;
+
+ yb.f();
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec4.C b/gcc/testsuite/g++.old-deja/g++.pt/spec4.C
new file mode 100644
index 0000000..b6e6858
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec4.C
@@ -0,0 +1,16 @@
+// Build don't link:
+
+template <class T>
+struct S {};
+
+template <>
+struct S<int>
+{
+ void f();
+ void g();
+};
+
+void S<int>::f() {}
+
+template <>
+void S<int>::g() {} // ERROR - does not match any template declaration
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec5.C b/gcc/testsuite/g++.old-deja/g++.pt/spec5.C
new file mode 100644
index 0000000..553d956
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec5.C
@@ -0,0 +1,20 @@
+// Build don't link:
+
+template <class T>
+void f(T t1, T t2);
+
+template <>
+void f(int i, int j);
+
+template <class T>
+void g(T t1, T t2) {}
+
+template void g(int i, int j);
+
+void h()
+{
+ f(3, 'c'); // ERROR - no matching function
+ g(3, 'c'); // ERROR - no matching function
+}
+
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec6.C b/gcc/testsuite/g++.old-deja/g++.pt/spec6.C
new file mode 100644
index 0000000..b41ad9d
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec6.C
@@ -0,0 +1,29 @@
+// Build don't link:
+
+struct S1
+{
+ template <class T>
+ void f(T t1, T t2);
+
+ template <>
+ void f(int i1, int i2);
+};
+
+template <class U>
+struct S2
+{
+ template <class T>
+ void f(T t1, T t2);
+
+ template <>
+ void f(int i1, int i2);
+};
+
+void h()
+{
+ S1 s1;
+ s1.f(3, 'c'); // ERROR - no matching function
+
+ S2<char> s2;
+ s2.f(3, 'c'); // ERROR - no matching function
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec7.C b/gcc/testsuite/g++.old-deja/g++.pt/spec7.C
new file mode 100644
index 0000000..81358d9
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec7.C
@@ -0,0 +1,19 @@
+extern "C" void abort();
+
+template <class T>
+void f(T t1, T t2);
+
+template <>
+void f(int i, int j)
+{
+ abort();
+}
+
+void f(short s, char c)
+{
+}
+
+int main()
+{
+ f(3, 'c');
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec8.C b/gcc/testsuite/g++.old-deja/g++.pt/spec8.C
new file mode 100644
index 0000000..966f69f
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec8.C
@@ -0,0 +1,27 @@
+extern "C" void abort();
+
+template <void* P>
+void f(int j);
+
+template <int I>
+void f(int j);
+
+
+template <void* P>
+void f(int j)
+{
+ abort();
+}
+
+
+template <int I>
+void f(int j)
+{
+}
+
+
+int main()
+{
+ f<3>(7);
+}
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec9.C b/gcc/testsuite/g++.old-deja/g++.pt/spec9.C
new file mode 100644
index 0000000..e2a2208
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/spec9.C
@@ -0,0 +1,21 @@
+extern "C" void abort();
+
+template <class T>
+inline int f(T t)
+{
+ return 0;
+}
+
+int main()
+{
+ if (!f(3))
+ abort();
+}
+
+template <>
+int f(int i)
+{ // ERROR - specialization of f<int>(int) after instantiation
+ return 1;
+}
+
+
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static_cast.C b/gcc/testsuite/g++.old-deja/g++.pt/static_cast.C
new file mode 100644
index 0000000..f4c334e
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.pt/static_cast.C
@@ -0,0 +1,22 @@
+// Build don't link:
+
+template <class InputIterator, class BinaryOperation>
+void accumulate(InputIterator first,
+ BinaryOperation binary_op) {
+}
+
+
+template<class R> int p( int val, R& r )
+{
+ return val + r;
+}
+
+template<class R> void f(R)
+{
+ accumulate(0, static_cast<int (*)(int, R&)>(p) );
+}
+
+main()
+{
+ f(0);
+}
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename3.C b/gcc/testsuite/g++.old-deja/g++.pt/typename3.C
index 13a1fcc..4a8f05b 100644
--- a/gcc/testsuite/g++.old-deja/g++.pt/typename3.C
+++ b/gcc/testsuite/g++.old-deja/g++.pt/typename3.C
@@ -1,17 +1,20 @@
// Build don't link:
-// GROUPS passed templates
+
template <class T>
-struct bar {
- typedef typename T::baz baz;
+struct A
+{
+ typedef T A_Type;
};
-template <class T>
-void foo(T)
+
+template <class U>
+struct B : public A<U>
{
- bar<T>::baz(); // ERROR - T is int.
-}
+ A_Type Func();
+};
+
-void foobar()
+template <class U>
+A<U>::A_Type B<U>::Func()
{
- foo(3);
}