2 // GROUPS passed templates
10 Vector (int s) : sz (s) { v = new T[sz]; }
11 ~Vector () { delete[] v; }
12 T &operator[] (int i) { return v[i]; }
13 int size () { return sz; }
16 template<class T>// { dg-message "" } previous definition of T
19 typedef T T;// { dg-error "" } use of template type T in typedef to T
20 static int lessthan (T &a, T &b) { return a < b; }
26 static void sort (Vector<Comp::T> &);// { dg-error "" } use of bad T
30 void Sort<Comp>::sort (Vector<Comp::T> &v)// { dg-error "" } use of bad T
34 for (int i = 0; i < n - 1; i++)
35 for (int j = n - 1; i < j; j--)
36 if (Comp::lessthan (v[j], v[j - 1]))
38 typename Comp::T temp = v[j];
47 Sort<Comparator<int> >::sort (vi); // { dg-error "'sort' is not a member of 'Sort<Comparator<int> >'" }