tests from mark
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Jan 1998 00:57:39 +0000 (00:57 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 20 Jan 1998 00:57:39 +0000 (00:57 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@17427 138bc75d-0d04-0410-961f-82ee72b054a4

37 files changed:
gcc/testsuite/g++.old-deja/g++.mike/p5840.C
gcc/testsuite/g++.old-deja/g++.mike/pt3.C
gcc/testsuite/g++.old-deja/g++.mike/pt4.C
gcc/testsuite/g++.old-deja/g++.other/static1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/bad-type.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit32.C
gcc/testsuite/g++.old-deja/g++.pt/explicit34.C
gcc/testsuite/g++.old-deja/g++.pt/explicit38.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit39.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit40.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit41.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit42.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/explicit43.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/instantiate1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/local1.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/local2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/local3.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/local4.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/local5.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/memtemp28.C
gcc/testsuite/g++.old-deja/g++.pt/memtemp65.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/memtemp66.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/memtemp67.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/recursion.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/recursion2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec10.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec11.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec2.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec3.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec4.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec5.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec6.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec7.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec8.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/spec9.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/static_cast.C [new file with mode: 0644]
gcc/testsuite/g++.old-deja/g++.pt/typename3.C

index 46a161b..53b9510 100644 (file)
@@ -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;
 }
index b2abc2b..a61d902 100644 (file)
@@ -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;
index 00e8ad0..7c1563e 100644 (file)
@@ -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 (file)
index 0000000..c18e55c
--- /dev/null
@@ -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 (file)
index 0000000..6b22b86
--- /dev/null
@@ -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);
+}
index 7c0e285..5942fe7 100644 (file)
@@ -12,7 +12,7 @@ struct S<int>
   void foo();
 };
 
-template <>
+
 void S<int>::foo()
 {
 }
index 40c1da0..487525e 100644 (file)
@@ -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 (file)
index 0000000..27121b6
--- /dev/null
@@ -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 (file)
index 0000000..906ef30
--- /dev/null
@@ -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 (file)
index 0000000..d237924
--- /dev/null
@@ -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 (file)
index 0000000..b5ca475
--- /dev/null
@@ -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 (file)
index 0000000..c19ffd0
--- /dev/null
@@ -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 (file)
index 0000000..6396f09
--- /dev/null
@@ -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 (file)
index 0000000..1d9c758
--- /dev/null
@@ -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 (file)
index 0000000..1b9e515
--- /dev/null
@@ -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 (file)
index 0000000..4aafc69
--- /dev/null
@@ -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 (file)
index 0000000..58c2627
--- /dev/null
@@ -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 (file)
index 0000000..6a7eb34
--- /dev/null
@@ -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 (file)
index 0000000..b49525c
--- /dev/null
@@ -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;
+}
+   
index ab3ce2d..37e79c8 100644 (file)
@@ -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 (file)
index 0000000..ef49d84
--- /dev/null
@@ -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 (file)
index 0000000..d7c1f57
--- /dev/null
@@ -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 (file)
index 0000000..bcf5960
--- /dev/null
@@ -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 (file)
index 0000000..7efaeb0
--- /dev/null
@@ -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 (file)
index 0000000..8cb3a2b
--- /dev/null
@@ -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 (file)
index 0000000..10947aa
--- /dev/null
@@ -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 (file)
index 0000000..4369f18
--- /dev/null
@@ -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 (file)
index 0000000..338c69e
--- /dev/null
@@ -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 (file)
index 0000000..b0e710f
--- /dev/null
@@ -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 (file)
index 0000000..b6e6858
--- /dev/null
@@ -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 (file)
index 0000000..553d956
--- /dev/null
@@ -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 (file)
index 0000000..b41ad9d
--- /dev/null
@@ -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 (file)
index 0000000..81358d9
--- /dev/null
@@ -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 (file)
index 0000000..966f69f
--- /dev/null
@@ -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 (file)
index 0000000..e2a2208
--- /dev/null
@@ -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 (file)
index 0000000..f4c334e
--- /dev/null
@@ -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);
+}
index 13a1fcc..4a8f05b 100644 (file)
@@ -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);
 }