diff options
Diffstat (limited to 'gcc_arm/testsuite/g++.old-deja/g++.pt')
512 files changed, 10035 insertions, 0 deletions
diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/alignof.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/alignof.C new file mode 100755 index 0000000..0cfeed4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/alignof.C @@ -0,0 +1,21 @@ +extern "C" void abort(); + +struct S +{ + char c; + double d; +}; + + +template <class T> +void foo(T) +{ + if (__alignof__(T) != __alignof__(S)) + abort(); +} + + +int main() +{ + foo(S()); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/array1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/array1.C new file mode 100755 index 0000000..669600f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/array1.C @@ -0,0 +1,10 @@ +template <class T, unsigned N> + unsigned size(T (&)[N]) { return N; } +template <class T, unsigned N> + unsigned size(T const (&)[N]) { return N; } + +int main() { + short iarray[] = { 1, 2, 3, 4, 5 }; + const short carray[] = { 1, 2, 3, 4, 5 }; + return size(iarray) - size(carray); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/array2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/array2.C new file mode 100755 index 0000000..6c5810e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/array2.C @@ -0,0 +1,14 @@ +// Build don't link: + +template<int N, class C> +class Bar {}; + +template<class C> +class Huh {}; + +template<int N> +void foo(const Bar<N,Huh<float[1]> > &x) {} + +int main() { + foo(Bar<3,Huh<float[1]> >()); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/array3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/array3.C new file mode 100755 index 0000000..ec5e1e0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/array3.C @@ -0,0 +1,5 @@ +// Build don't link: +// Origin: Brendan Kehoe <brendan@cygnus.com> + + template <int x> int foo(char[4][x]) { return x; } + int (*bar)(char[4][3]) = &foo; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/auto_ptr.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/auto_ptr.C new file mode 100755 index 0000000..dd5b988 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/auto_ptr.C @@ -0,0 +1,54 @@ +template <typename Y> struct auto_ptr_ref { + Y* py; + auto_ptr_ref(Y* p) : py(p) {} +}; +template<typename X> struct auto_ptr { + X* px; + public: + typedef X element_type; + + explicit auto_ptr(X* p =0) throw() : px(p) {} + auto_ptr(auto_ptr& r) throw() : px(r.release()) {} + template<typename Y> + auto_ptr(auto_ptr<Y>& r) throw() : px(r.release()) {} + + auto_ptr& operator=(auto_ptr& r) throw() { + reset(r.release()); + return *this; + } + template<typename Y> auto_ptr& operator=(auto_ptr<Y>& r) throw() { + reset(r.release()); + return *this; + } + + ~auto_ptr() { delete px; } + + X& operator*() const throw() { return *px; } + X* operator->() const throw() { return px; } + X* get() const throw() { return px; } + X* release() throw() { X* p=px; px=0; return p; } + void reset(X* p=0) throw() { if (px != p) delete px, px = p; } + + auto_ptr(auto_ptr_ref<X> r) throw() : px(r.py) {} + template<typename Y> operator auto_ptr_ref<Y>() throw() { + return auto_ptr_ref<Y>(release()); + } + template<typename Y> operator auto_ptr<Y>() throw() { + return auto_ptr<Y>(release()); + } +}; + +struct Base { Base() {} virtual ~Base() {} }; +struct Derived : Base { Derived() {}; }; + +auto_ptr<Derived> f() { auto_ptr<Derived> null(0); return null; } +void g(auto_ptr<Derived>) { } +void h(auto_ptr<Base>) { } + +int main() { + auto_ptr<Base> x(f()); + auto_ptr<Derived> y(f()); + x = y; + g(f()); + h(f()); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/bad-type.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/bad-type.C new file mode 100755 index 0000000..6b22b86 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/call1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/call1.C new file mode 100755 index 0000000..b9836bb --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/call1.C @@ -0,0 +1,15 @@ +// Build don't link: + +struct IsCompressed { }; +struct Field { + bool IsCompressed() const { return true; } +}; + +template<class C> +inline bool +for_each(const Field& p, IsCompressed, C) +{ + return p.IsCompressed(); +} + +template bool for_each<int>(const Field& p, IsCompressed, int); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/call2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/call2.C new file mode 100755 index 0000000..51b2469 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/call2.C @@ -0,0 +1,14 @@ +// Build don't link: + +struct IsCompressed { }; +struct Field { +}; + +template<class C> +inline bool +for_each(const Field& p, IsCompressed, C) +{ + return p.IsCompressed(); // ERROR - calling type like a method +} + +template bool for_each<int>(const Field& p, IsCompressed, int); // ERROR - instantiated from here diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/const1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/const1.C new file mode 100755 index 0000000..8ac8a51 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/const1.C @@ -0,0 +1,4 @@ +// Build don't link: +template <class T> struct B { static const int i = 3; }; +template <class T> struct A { static const int i = B<T>::i; }; +enum { i = A<int>::i }; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/conv1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/conv1.C new file mode 100755 index 0000000..19e433e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/conv1.C @@ -0,0 +1,19 @@ +// Build don't link: + +template <class T> +struct S1 {}; + +struct S2 +{ + template <class T> + operator S1<T>*(); +}; + +struct D: public S1<int> { +}; + +void f() +{ + S2 s; + (D*) s; // ERROR - cannot convert +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/conv2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/conv2.C new file mode 100755 index 0000000..f3e0b35 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/conv2.C @@ -0,0 +1,15 @@ +// Build don't link: + +template<class T> +class A { +public: + operator const T*() const; + const T* cast() const; +}; + +template<class T> +const T* A<T>::cast() const { + return operator const T*(); +} + +template class A<char>; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/copy1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/copy1.C new file mode 100755 index 0000000..7981530 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/copy1.C @@ -0,0 +1,29 @@ +int i = 0; + +template <class T> +class F +{ +public: + F() {} + + template <class T2> F(F<T2>) + { + i = 1; + } +}; + + +F<int> +foo() +{ + F<int> f1; + F<int> f2(f1); + return f1; +} + +int +main() +{ + return i; +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash1.C new file mode 100755 index 0000000..3d3dd5e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash1.C @@ -0,0 +1,11 @@ +template<class T> class A { + public: + class subA {}; +}; + + +template<class T> class B : public A<T> { + public: + class subB : public A::subA {}; // ERROR - not a class or namespace +}; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash10.C new file mode 100755 index 0000000..033e234 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash10.C @@ -0,0 +1,11 @@ +// Build don't link: + +template<int M, int N> +class GCD { +public: + enum { val = (N == 0) ? M : GCD<N, M % N>::val }; +}; + +int main() { + GCD< 1, 0 >::val; // ERROR - division +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash11.C new file mode 100755 index 0000000..30c72a6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash11.C @@ -0,0 +1,13 @@ +// Build don't link: + +class A +{ + class A_impl; + public: + A(){} +}; + + +template <class j> class A::A_impl +{ // ERROR - does not declare a template +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash12.C new file mode 100755 index 0000000..ade8139 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash12.C @@ -0,0 +1,13 @@ +// Build don't link: +// Special g++ Options: -g + +template <class C> +class CenteringTag { +}; + +struct S { + template <class B, class C> + static void f() { + CenteringTag<C> ctag; + } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash13.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash13.C new file mode 100755 index 0000000..f3de38e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash13.C @@ -0,0 +1,6 @@ +// Build don't link: + +template <class T> struct A {}; +template <class T> struct A<T>; // ERROR - does not specialize args +template <class T> const struct A; // ERROR - parse error +template <class T> template A<int>; // ERROR - .* diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash14.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash14.C new file mode 100755 index 0000000..f698316 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash14.C @@ -0,0 +1,5 @@ +// Build don't link: + +template <class T> struct A {}; +template <class T> struct A<T*>; +A<int*> ai; // ERROR - incomplete type diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash15.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash15.C new file mode 100755 index 0000000..75b1054 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash15.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class T> +template <class U> +struct A { // ERROR - too many template parameter lists +public: + A() {} + + A(const A<T>& b) {} // ERROR - invalid use of template +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash16.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash16.C new file mode 100755 index 0000000..ed12b90 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash16.C @@ -0,0 +1,28 @@ +// Build don't link: +// Special g++ Options: + +extern "C" void qsort(); + +struct R { + int count; + int state1; + int state2; +}; + +int cmp_d(const R* a, const R* b) { + return a->count > b->count; +} + +namespace CXX { + template<class T, int i1, int i2> + inline void qsort (T b[i1][i2], int (*cmp)(const T*, const T*)) { + ::qsort ((void*)b, i1*i2, sizeof(T), (int (*)(const void *, const void *))cmp); + } +} + +using namespace CXX; + +void sort_machine() { + struct R d[256][256]; + qsort<R,256> (d, cmp_d); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash17.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash17.C new file mode 100755 index 0000000..c4dd969 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash17.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <int B> +class foo; + +template <class U> +class bar +{ + typedef foo<(U::id > 0)> foobar; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash18.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash18.C new file mode 100755 index 0000000..b12c702 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash18.C @@ -0,0 +1,23 @@ +// Build don't run: + +template<class T> +class foo { + T deft; + + template<class U> int priv (U u, T t) { return u - t; } +public: + foo (T t) : deft (t) {} + + template<class U> int pub (U u) { + int (foo::*fn) (U, T); + fn = &foo<T>::template priv<U>; + return (this->*fn) (u, deft); + } +}; + +int +main () +{ + foo<long> fff (5); + return fff.pub (3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash19.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash19.C new file mode 100755 index 0000000..2da6dd9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash19.C @@ -0,0 +1,19 @@ +// Build don't link: + +template <int I> +void f() +{ + class C { public: int c; }; + + struct S { + void g() { + C e; + e.c = 3; + }; + }; + + S s; + s.g(); +} + +template void f<7>(); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash2.C new file mode 100755 index 0000000..3b900c7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash2.C @@ -0,0 +1,14 @@ +// Build don't link: + +template <class T> +struct S1 +{ + T* t; + static int foo; +}; + + +struct S2 : public S1<S2> +{ + S2* s; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash20.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash20.C new file mode 100755 index 0000000..29b4281 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash20.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T = int> +struct A { const T x; A() : x(0) { } A(T x) : x(x) { } }; + +template <class B> +void func () { B y; y = B(); } // ERROR - can't use default assignment + +int main (void) { func< A<> >(); } // ERROR - instantiated from here diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash21.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash21.C new file mode 100755 index 0000000..c84809b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash21.C @@ -0,0 +1,26 @@ +// Build don't link: +// Special g++ Options: + +class Pooled +{ +}; + +class RefCounted +{ +}; + +class BrickExpressionBase : public RefCounted, public Pooled +{ +}; + +template<unsigned Dim, class LHS, class RHS, class OP> +class BrickExpression : public BrickExpressionBase +{ +}; + +template <unsigned Dim, class T> +void f() +{ + typedef BrickExpression<Dim, T, T, T> ExprT; + ExprT(3).apply; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash22.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash22.C new file mode 100755 index 0000000..e947ef3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash22.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T> +struct S1 {}; + +template <class T, class U = S1<T> > +struct S2 {}; + +template struct S2<100>; // ERROR - type/value mismatch diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash23.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash23.C new file mode 100755 index 0000000..ac4fae0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash23.C @@ -0,0 +1,16 @@ +// Build don't link: + +template <class A, class B> void foo(); +template <class C> class bar { +public: + int i; + template <class B> friend void foo<C,B>(); // ERROR - template-id +}; +template <class A, class B> void foo() { + bar<A> baz; baz.i = 1; + bar<int> buz; buz.i = 1; +} +int main() { + foo<void,void>(); + foo<int,void>(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash24.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash24.C new file mode 100755 index 0000000..9c31af6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash24.C @@ -0,0 +1,11 @@ +// Build don't link: + +template<typename T, template <class> class U> void template_fn (T); +template<typename T> void callme ( void (*)(T)); + +template<typename T> struct S1; + +int main() +{ + callme(&template_fn<double, S1>); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash25.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash25.C new file mode 100755 index 0000000..f587585 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash25.C @@ -0,0 +1,7 @@ +// Build don't link: + +template <class T> +void f() +{ + int i[1 << 3]; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash26.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash26.C new file mode 100755 index 0000000..d2101bd --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash26.C @@ -0,0 +1,15 @@ +// Build don't link: +// Origin: Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr> + +double f(double); +typedef double (*M)(double); + +class A { +public: + template <const M n> void g(); +}; + +class B: public A { +public: + void g() { A::g<f>(); } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash27.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash27.C new file mode 100755 index 0000000..f52f1ba --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash27.C @@ -0,0 +1,13 @@ +// Build don't link: + +template<int i> int f (void) +{ + if (__extension__ ({ 1; })) + return 0; + return 1; +} + +void g (void) +{ + f<1> (); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash28.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash28.C new file mode 100755 index 0000000..752c970 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash28.C @@ -0,0 +1,14 @@ +// Build don't link: +// Special g++ Options: + +template <class ARRY> +inline unsigned int asize(ARRY &a) +{ + return sizeof(a) / sizeof(a[0]); +} + +int f(unsigned int n) { + int x[n]; + + asize(x); // ERROR - no matching function +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash3.C new file mode 100755 index 0000000..0d2a7cd --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash3.C @@ -0,0 +1,16 @@ +// Build don't link: + +template <class Type> +class CVector { +public: + CVector<int> f() const + { + CVector<int> v(n); + return v; + } + CVector<long> g() const + { + CVector<long> v(n); + return v; + } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash4.C new file mode 100755 index 0000000..510d4cd --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash4.C @@ -0,0 +1,11 @@ +// Build don't link: + +template <unsigned rank> +class Tensor +{ +}; + +template <unsigned rank> +class Tensor<2> : Tensor<rank> { // ERROR - template parameters not used +}; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash5.C new file mode 100755 index 0000000..786cdf2 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash5.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <class T, int i> +struct K { + void f(); +}; + +template <class T> +void +K<T, i>::f() +{ // ERROR - template parameters +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash6.C new file mode 100755 index 0000000..09e8df0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash6.C @@ -0,0 +1,23 @@ +// Build don't link: + +template <class T> class List; + +template <class T> +struct ListIterator +{ + ListIterator (); + ListIterator (const ListIterator<T>& rhs); +}; + +template <class T> +struct List +{ + void length () const { + for (ListIterator<T> li; li; ); // ERROR - used where a `bool' + } +}; + +void test(List<int>& vals) +{ + vals.length(); // ERROR - instantiated from here +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash7.C new file mode 100755 index 0000000..9ee7b2c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash7.C @@ -0,0 +1,10 @@ +// Build don't link: + +class foo +{ +}; + +template <class T : public foo> // ERROR - base clause +struct bar +{ +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash8.C new file mode 100755 index 0000000..deff42d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash8.C @@ -0,0 +1,34 @@ +// Build don't link: + +template<class T> +class TestClass1 { +public: + TestClass1() { } +}; + +template<class T> +class TestClass2 { +public: + TestClass2() { } + T operator()(int) { } +}; + +template<class T> +void doit(T x) { + TestClass1<T> q1; + q1 = TestClass1<T>(); + TestClass2<T> q2; + q2 = TestClass2<T>(); + + TestClass1<T> p1; + p1 = TestClass1(); // ERROR - template used as expression + + TestClass2<T> p2; + p2 = TestClass2(); // ERROR - template used as expression +} + +int main() { + double x; + doit(x); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/crash9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash9.C new file mode 100755 index 0000000..297b8ac --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/crash9.C @@ -0,0 +1,11 @@ +// Build don't link: + +template <class T> +void f(T) {} // ERROR - parameter has incomplete type + +class C; + +void g(const C& c) +{ + f(c); // ERROR - invalid use of undefined type +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ctor1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ctor1.C new file mode 100755 index 0000000..9e36706 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ctor1.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <typename _CharT> + struct moneypunct +{ + moneypunct (); +}; + +template <> + moneypunct<char>::moneypunct (); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/decl1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/decl1.C new file mode 100755 index 0000000..5814251 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/decl1.C @@ -0,0 +1,19 @@ +struct S { + template <class T> + int f(T), g(T); // ERROR - more than one declarator +}; + +template <class T> +void x(T), y(T); // ERROR - more than one declarator + +template <class T> +struct S2 +{ + static int i, j; // OK. +}; + +template <class T> +int S2<T>::i, S2<T>::j; // ERROR - more than one declarator + +template <> +int S2<int>::i, S2<double>::i; // ERROR - more than one declarator diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/decl2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/decl2.C new file mode 100755 index 0000000..2e2b91c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/decl2.C @@ -0,0 +1,9 @@ +// Build don't link: + +// Simplified from testcase by Christophe Boyanique <boyan@imac.u-paris2.fr> + +// crash test - XFAIL *-*-* + +template <class T> struct foo { foo(); }; +template<class T> foo<T>::foo() {} +T // ERROR - currently an ICE diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg.C new file mode 100755 index 0000000..314339d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg.C @@ -0,0 +1,10 @@ +template <class T> +void f(T t, int i = 10); + +template <class T> +void f(T t, int i) {} + +int main() +{ + f(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg2.C new file mode 100755 index 0000000..444ecc4 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/defarg3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg3.C new file mode 100755 index 0000000..9a7e046 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg3.C @@ -0,0 +1,16 @@ +// Build don't link: + +template <class T> +struct S; + +template <class T = int> +struct S {}; + +template <class T> +struct S; + +void f() +{ + S<> s; +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg4.C new file mode 100755 index 0000000..9d5df8c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg4.C @@ -0,0 +1,32 @@ +// Build don't link: + +template <class T> +struct S1 +{ + void foo(T = t()); + + static T t(); +}; + + +template <class T> +struct S2 +{ + void bar(); +}; + + +template <class T> +void S2<T>::bar () +{ + S1<T> st; + st.foo(); +} + + +int main() +{ + S2<int> s2i; + s2i.bar(); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg5.C new file mode 100755 index 0000000..6a68bad --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg5.C @@ -0,0 +1,24 @@ +// Build don't link: + +template <int dim> +class Point { + public: + Point (Point<dim> &); + Point<dim> & operator = (Point<dim> &); +}; + + + +template <int dim> +class bar{ + public: + void foo (Point<dim> p = Point<dim>()); +}; + + + +template <> +void bar<2>::foo (Point<2> p) { + const int dim = 2; + Point<dim> q = p; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg6.C new file mode 100755 index 0000000..0094c5c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg6.C @@ -0,0 +1,27 @@ +// Build don't link: + +template <class T> +struct C { + template <class U> + void f(U); // OK + + template <class V = int> + struct I {}; // OK + + template <class W = int> + void h(W); // ERROR - default argument + + template <class Y> + void k(Y); +}; + +template <class T> +template <class U = double> +void C<T>::f(U) {} // ERROR - default argument + +template <class X = void*> +void g(X); // ERROR - default argument + +template <class T = double> +template <class Y> +void C<T>::k(Y) {} // ERROR - default argument diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg7.C new file mode 100755 index 0000000..0db043f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg7.C @@ -0,0 +1,11 @@ +// Build don't link: + +template <int Dim, class T, class EngineTag> +class Engine {}; + +struct Brick; + +template<int Dim, class T = double , class EngineTag = Brick > +struct ConstArray { + static const int dimensions = Engine<Dim, T, EngineTag>::dimensions; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg8.C new file mode 100755 index 0000000..6bb1125 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/defarg8.C @@ -0,0 +1,14 @@ +// Build don't link: + +// Default arguments containing more than one non-nested explicit +// template argument leads to parse error + +template <class T> class foo1; +template <class T, class U> class foo2; + +struct bar { + template <class T, class U> + bar(int i = foo1<T>::baz, // ok + int j = int(foo2<T, U>::baz), // ok + int k = foo2<T, U>::baz) {} // gets bogus error - before > - XFAIL *-*-* +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/derived1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/derived1.C new file mode 100755 index 0000000..e2275f4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/derived1.C @@ -0,0 +1,24 @@ +// Build don't link: + +class A +{ +public: + typedef int Info; +}; + +template <class T> +class B : public A +{ +public: + typedef struct{ + int a; + int b; + } Info; +}; + +void f() +{ + B<A>::Info ie; + ie.a=1; + ie.b=2; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/eichin01.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/eichin01.C new file mode 100755 index 0000000..154587b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/eichin01.C @@ -0,0 +1,27 @@ +// Build don't run: + +/* + + +*/ + + +template <class X> class TC { +public: + X aaa; + static X sss; + TC(X a) { aaa = a; } + TC(X a, X s) { aaa = a; sss = s; } + void sz(X s) { sss = s; } +}; + +float TC<float>::sss; +long TC<long>::sss; + +TC<long> xjj(1,2); + +int main(int,char*) { + TC<float> xff(9.9,3.14); + xjj.sz(123); + xff.sz(2.71828); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/eichin01a.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/eichin01a.C new file mode 100755 index 0000000..1a37eeb --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/eichin01a.C @@ -0,0 +1,21 @@ +template <class X> class TC { +public: + X aaa; + static X sss; + TC(X a) {aaa = a; } + TC(X a, X s) {aaa = a; sss = s; } + void sz(X s) { sss = s; } +}; + + +long TC<long>::sss; +float TC<float>::sss; + +TC<long> xjj(1,2); + +int main(int,char*) { + TC<float> xff(9.9,3.14); + xjj.sz(123); + xff.sz(2.71828); + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/eichin01b.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/eichin01b.C new file mode 100755 index 0000000..51bb447 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/eichin01b.C @@ -0,0 +1,21 @@ +template <class X> class TC { +public: + X aaa; + static X sss; + TC(X a) {aaa = a; } + TC(X a, X s) {aaa = a; sss = s; } + void sz(X s) { sss = s; } + void syy(X syarg) { sss = syarg; } +}; + +long TC<long>::sss; +float TC<float>::sss; + +TC<long> xjj(1,2); + +int main(int,char*) { + TC<float> xff(9.9,3.14); + xjj.sz(123); + xff.sz(2.71828); + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum.C new file mode 100755 index 0000000..4fe84a4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum.C @@ -0,0 +1,18 @@ +// Build don't link: +// GROUPS passed enums +template<class T> +struct templ +{ + enum { val = 0 }; +}; +struct Foo +{ + enum { + bar = 0, + len = templ<int>::val + }; +}; +void func() +{ + int s = Foo::bar; // Ensure that expansion of templ did not erase bar +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum10.C new file mode 100755 index 0000000..713c11c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum10.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <class T> +struct S { + enum E { a = (int) T::b }; +}; + +struct S2 { + enum E2 { b }; +}; + +template class S<S2>; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum11.C new file mode 100755 index 0000000..77631c4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum11.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class T> void f1() +{ + struct foo { enum T2 { + un, du, toi }; + }; +} + +void f2() { f1<int>(); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum12.C new file mode 100755 index 0000000..b1c2b16 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum12.C @@ -0,0 +1,16 @@ +// Build don't link: + +template <int I> +struct S1 { }; + +template <class T> +struct S2 { + enum { x = 3 }; + + void f(S1<x>&); +}; + +template <class T> +void S2<T>::f(S1<x>&) +{ +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum2.C new file mode 100755 index 0000000..5a2d7f3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum2.C @@ -0,0 +1,17 @@ +// Build don't link: + +struct U { + static int STATIC; +}; + +template <int* x> class FOO { +public: + enum { n = 0 }; +}; + +template <class A> class BAR { +public: + enum { n = FOO<&A::STATIC>::n }; +}; + +int n = BAR<U>::n; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum3.C new file mode 100755 index 0000000..d39da3a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum3.C @@ -0,0 +1,14 @@ +struct S { enum en { s0, s1, s2 }; }; + +template<typename S::en e> +int val( ) +{ + return e; +} + + +int main() +{ + return val<S::s0>( ); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum4.C new file mode 100755 index 0000000..28f4b29 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum4.C @@ -0,0 +1,16 @@ +// Build don't link: + +template <class T> +struct U +{ + T mT; +}; + +template <class H> +struct M +{ + enum FLAG {On, Off}; + U<FLAG> mUF; +}; + +M<char> gm; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum5.C new file mode 100755 index 0000000..fc88afa --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum5.C @@ -0,0 +1,4 @@ +// Build don't link: + +template <> +enum E {e}; // ERROR - template declaration of enum XFAIL *-*-* diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum6.C new file mode 100755 index 0000000..acfd681 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum6.C @@ -0,0 +1,14 @@ +// Build don't link: + +template <class T> +struct vector {}; + +template<class T> +void fn(T) +{ + enum tern { H, L, X, U }; + + vector<tern> ternvec; // ERROR - composed from a local type +} + +template void fn(int); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum7.C new file mode 100755 index 0000000..47dcbfa --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum7.C @@ -0,0 +1,27 @@ +template <int I> +int f() +{ + enum E { a = I }; + + struct S { + int g() { + E e; + e = a; + return (int) e; + }; + }; + + S s; + + return s.g(); +} + + +int main() +{ + if (f<7>() != 7) + return 1; + if (f<-3>() != -3) + return 1; + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum8.C new file mode 100755 index 0000000..e5cc58a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum8.C @@ -0,0 +1,18 @@ +// Build don't link: + +template <int I> +void f(); + +template <> +void f<4>() {} + +template <class T> +struct S +{ + enum E { a = 1, b = a + 3 }; +}; + +int main() +{ + f<S<int>::b>(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/enum9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum9.C new file mode 100755 index 0000000..5ab8e8b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/enum9.C @@ -0,0 +1,13 @@ +// Build don't link: + +template <typename _CharT> +class _Format_cache +{ +public: + enum { + _S_digits, _S_digits_end = _S_digits+10, + _S_xdigits = _S_digits_end + }; +}; + +template class _Format_cache<int>; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit1.C new file mode 100755 index 0000000..0daf54f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit1.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +void foo(T t) {} + +void bar() +{ + &foo<double>; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit10.C new file mode 100755 index 0000000..d90b8d0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit10.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +void foo(T t); + +int main() +{ + foo<int>(3.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit11.C new file mode 100755 index 0000000..fb7834f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit11.C @@ -0,0 +1,14 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +void foo(T t); + +template <class T> +struct S {}; + +int main() +{ + S<int> si; + + foo<S<int> >(si); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit12.C new file mode 100755 index 0000000..0defb19 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit12.C @@ -0,0 +1,19 @@ +// Build don't run: +// GROUPS passed templates +template <class U> +struct S +{ + template <class T> + void foo(T t); +}; + + +template <> +template <> +void S<char*>::foo<int>(int) {} + +int main() +{ + S<char*> s; + s.template foo<int>(3.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit13.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit13.C new file mode 100755 index 0000000..fbb7901 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit13.C @@ -0,0 +1,22 @@ +// Build don't run: +// GROUPS passed templates + +template <class U> +struct S +{ + template <class T> + void foo(T t); + + template <class T> + void bar(T t) { this->template foo<U>(3.74); } +}; + +template <> +template <> +void S<int>::foo(int) { } + +int main() +{ + S<int> s; + s.bar(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit14.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit14.C new file mode 100755 index 0000000..aa9d03f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit14.C @@ -0,0 +1,14 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +struct S +{ + template <class U> + typename U::R foo(U u); +}; + + +void bar() +{ + S<int> si; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit15.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit15.C new file mode 100755 index 0000000..290da42 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit15.C @@ -0,0 +1,30 @@ +// Build don't link: +// GROUPS passed templates +template<int N_rank> +class Array; + + +template<class T> +class ArraySectionInfo { +public: + enum { rank = 0 }; +}; + + +template<class T1> +class SliceInfo { +public: + enum { + rank = ArraySectionInfo<T1>::rank + }; + + typedef Array<rank> T_slice; +}; + +template<class T2> +typename SliceInfo<T2>::T_slice +foo(T2 r2) +{ + return SliceInfo<T2>::T_slice(); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit16.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit16.C new file mode 100755 index 0000000..c7a8733 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit16.C @@ -0,0 +1,28 @@ +// Build don't link: +// GROUPS passed templates +template<int N_rank> +class Array; + + +template<class T> +class ArraySectionInfo { +public: + enum { rank = 0 }; +}; + + +template<class T1> +class SliceInfo { +public: + static const int rank = ArraySectionInfo<T1>::rank; + + typedef Array<rank> T_slice; +}; + +template<class T2> +typename SliceInfo<T2>::T_slice +foo(T2 r2) +{ + return SliceInfo<T2>::T_slice(); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit17.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit17.C new file mode 100755 index 0000000..8e8688d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit17.C @@ -0,0 +1,22 @@ +// Build don't link: +// GROUPS passed templates +template <class T, class U> +void foo(U u, T t); + +template <class T> +void foo(T t); + +template <class T> +struct S {}; + +template <class T> +void foo(const S<T>&); + +void bar() +{ + void (*fn)(double, int) = + (void (*)(double, int)) &foo<int>; + void (*fn2)(double) = foo<double>; + foo<int>(3, 3.0); + foo<int>(S<int>()); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit18.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit18.C new file mode 100755 index 0000000..20c4b75 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit18.C @@ -0,0 +1,11 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +int foo(T t) { return 0; } + +int foo(int i); + +int main() +{ + return foo<int>(3.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit19.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit19.C new file mode 100755 index 0000000..b209bbe --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit19.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +int foo(T t); + +template <> +int foo<int>(int i) { return 0; } + +int main() +{ + return foo<int>(3.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit2.C new file mode 100755 index 0000000..4d88c39 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit2.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +void foo(T t) {} + +void bar() +{ + (void (*)(int)) &foo<double>; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit20.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit20.C new file mode 100755 index 0000000..918ff3a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit20.C @@ -0,0 +1,7 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +T foo(T t); + +template <> +int foo<char>(char c); // ERROR - does not match any template declaration diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit21.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit21.C new file mode 100755 index 0000000..a99a49b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit21.C @@ -0,0 +1,10 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +T foo(T* t); + +template <> +int foo<char>(char c); // ERROR - does not match declaration. + +template <> +int bar<char>(); // ERROR - no template bar. diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit22.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit22.C new file mode 100755 index 0000000..2cb2338 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit22.C @@ -0,0 +1,10 @@ +// Build don't link: +// GROUPS passed templates +template <class T, class U> +T foo(T t, U* u); // ERROR - template candidate + +template <class T> +T foo(T t, T* t); // ERROR - template candidate + +template <> +int foo<int>(int, int*); // ERROR - ambiguous template specialization diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit23.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit23.C new file mode 100755 index 0000000..cdffb15 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit23.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +int foo(T t) { return 1; } + +template <> +int foo<int>(int i) { return 0; } + +int main() +{ + return foo<int>(3.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit24.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit24.C new file mode 100755 index 0000000..42f4c3c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit24.C @@ -0,0 +1,7 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +int foo(T t); + +int foo<int>(int i) { return 0; } // ERROR - missing template <> + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit25.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit25.C new file mode 100755 index 0000000..0225216 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit25.C @@ -0,0 +1,13 @@ +// Build don't link: +// GROUPS passed templates +template <int I> +class S {}; + +template <int I, class T> +void foo(T t, S<I>); + +void bar() +{ + S<3> s3; + foo<3>("abc", s3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit26.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit26.C new file mode 100755 index 0000000..eba8d79 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit26.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +int foo(T t) { return 1; } + +template <> +int foo(int i) { return 0; } + +int main() +{ + &foo<int>; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit27.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit27.C new file mode 100755 index 0000000..4a5adb5 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit27.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +void foo(T t); + +template <> +void foo(int i) {} + +int main() +{ + &foo<int>; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit28.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit28.C new file mode 100755 index 0000000..b842b89 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit28.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +int foo(T t) { return 1; } + +template <> +int foo(int i) { return 0; } + +int main() +{ + return (*&foo<int>)(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit29.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit29.C new file mode 100755 index 0000000..a247779 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit29.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +int foo(T) { return 0; } + +int foo(int); + +int main() +{ + return foo<int>(3); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit3.C new file mode 100755 index 0000000..2a5309f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit3.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template <class T, class U> +void foo(T t, U u) {} + +void bar() +{ + (void (*)(double, int)) &foo<double>; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit30.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit30.C new file mode 100755 index 0000000..5a69713 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit30.C @@ -0,0 +1,11 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +void foo(T, T*); + + +void bar() +{ + double d; + (*((void (*)(int, double*)) &foo<int>))(3, &d); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit31.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit31.C new file mode 100755 index 0000000..61190f7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit31.C @@ -0,0 +1,16 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +struct S +{ + template <class U> + static double foo(U u) { return (double) u; } +}; + + +int main() +{ + double d = S<int>::template foo<char>(3.3); + + return (d >= 3.1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit32.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit32.C new file mode 100755 index 0000000..5942fe7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit32.C @@ -0,0 +1,25 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +struct S +{ +}; + + +template <> +struct S<int> +{ + void foo(); +}; + + +void S<int>::foo() +{ +} + + +void bar() +{ + S<int> si; + si.foo(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit33.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit33.C new file mode 100755 index 0000000..048a356 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit33.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +void foo(T t); + +template <> +void foo(int) {}; + +void foo(int) {} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit34.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit34.C new file mode 100755 index 0000000..0aede38 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit34.C @@ -0,0 +1,10 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +void foo(T t); + +template <> +void foo(int) {}; // ERROR - previously defined here. + +template <> +void foo<int>(int) {} // ERROR - duplicate specialization. diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit35.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit35.C new file mode 100755 index 0000000..c928263 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit35.C @@ -0,0 +1,16 @@ +// Build don't run: +// GROUPS passed templates +struct S +{ + template <class T> + void foo(T t); +}; + +template <> +void S::foo<int>(int i) { } + +int main() +{ + S s; + s.template foo<int>(3.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit36.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit36.C new file mode 100755 index 0000000..6f9e7c6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit36.C @@ -0,0 +1,24 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +void foo(T); + +class S { + friend void foo<>(int); + + int i; +}; + + +template <> +void foo(int) +{ + S s; + s.i = 3; +} + + +int main() +{ + foo(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit37.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit37.C new file mode 100755 index 0000000..4d911a4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit37.C @@ -0,0 +1,23 @@ +// Build don't run: +// GROUPS passed templates +class ostream {}; + +template <class T> +class S; + +template <class T> +void operator<<(ostream&, S<T>) {} + +template <class T> +class S +{ + friend void operator<<<>(ostream&, const S<T>); +}; + + +int main() +{ + ostream o; + + o << S<int>(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit38.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit38.C new file mode 100755 index 0000000..27121b6 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/explicit39.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit39.C new file mode 100755 index 0000000..906ef30 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/explicit4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit4.C new file mode 100755 index 0000000..911e7b3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit4.C @@ -0,0 +1,19 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +void foo(T t); + +template <class T> +struct S {}; + +template <class T> +void bar(T t) +{ + void (*f)(S<T> ) = &foo<S<T> >; +} + + +void baz() +{ + bar(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit40.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit40.C new file mode 100755 index 0000000..d237924 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/explicit41.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit41.C new file mode 100755 index 0000000..b5ca475 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/explicit42.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit42.C new file mode 100755 index 0000000..c19ffd0 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/explicit43.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit43.C new file mode 100755 index 0000000..6396f09 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/explicit5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit5.C new file mode 100755 index 0000000..2c2b763 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit5.C @@ -0,0 +1,19 @@ +// Build don't link: +// GROUPS passed templates +template <class T> +void foo(T t) {} + +template <class T> +struct S {}; + +template <class T> +void bar(T t) +{ + void (*f)(S<T> ) = &foo<S<T> >; +} + + +void baz() +{ + bar(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit50.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit50.C new file mode 100755 index 0000000..8c424cc --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit50.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit51.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit51.C new file mode 100755 index 0000000..e4a0a64 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit51.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit52.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit52.C new file mode 100755 index 0000000..368573e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit52.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit53.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit53.C new file mode 100755 index 0000000..e66cca9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit53.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit54.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit54.C new file mode 100755 index 0000000..9d185be --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit54.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit55.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit55.C new file mode 100755 index 0000000..c9d3125 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit55.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit56.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit56.C new file mode 100755 index 0000000..d202160 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit56.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit57.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit57.C new file mode 100755 index 0000000..d1f0ea8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit57.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit58.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit58.C new file mode 100755 index 0000000..7193d2d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit58.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit59.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit59.C new file mode 100755 index 0000000..847a80a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit59.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit6.C new file mode 100755 index 0000000..1ee7751 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit6.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template <class T> +int foo(T t); + +template <> +int foo(int i) { return 0; } + +int main() +{ + return foo<int>(3.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit60.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit60.C new file mode 100755 index 0000000..5fda333 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit60.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit61.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit61.C new file mode 100755 index 0000000..69b7891 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit61.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit62.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit62.C new file mode 100755 index 0000000..5917ce0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit62.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit63.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit63.C new file mode 100755 index 0000000..ce4d99a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit63.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit64.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit64.C new file mode 100755 index 0000000..2208b30 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit64.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit65.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit65.C new file mode 100755 index 0000000..a026e8e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit65.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/explicit66.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit66.C new file mode 100755 index 0000000..d4a3c62 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit66.C @@ -0,0 +1,11 @@ +void f(int) {} +void f(double); + +template <void (*fn)(int)> +void foo() {} + +int main() +{ + foo<f>(); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit67.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit67.C new file mode 100755 index 0000000..c8705f4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit67.C @@ -0,0 +1,20 @@ +struct S +{ + void f(int); + void f(double); +}; + +void g(int); +void g(double); + +template <int* IP> +void foo(); +template <long l> +void foo(); + +void bar() +{ + foo<S::f>(); // ERROR - no matching function + foo<g>(); // ERROR - no matching function + +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit68.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit68.C new file mode 100755 index 0000000..bc47c6c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit68.C @@ -0,0 +1,24 @@ +// Build don't link: + +template <bool B> +struct S +{ + static void g(); +}; + +template <bool B> +void g(); + +template<unsigned Length> +void f() +{ + const bool b = true; + g<b>(); + const bool b1 = (Length == 2); + S<b1>::g(); +} + +void h() +{ + f<3>(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit69.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit69.C new file mode 100755 index 0000000..671cf00 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit69.C @@ -0,0 +1,2 @@ +//Build don't link: +template class x {}; // ERROR - not a template instantiation diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit70.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit70.C new file mode 100755 index 0000000..ade83fd --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit70.C @@ -0,0 +1,43 @@ +// Build don't link: + +template <class T> +void f(T) {} + +template <class T> +struct S { + static T t; +}; + +template <class T> +T S<T>::t; + +template void f(int); +template void f(int); // ERROR - duplicate explicit instantiation +template int S<int>::t; +template int S<int>::t; // ERROR - duplicate explicit instantiation +template class S<double>; +template class S<double>; // ERROR - duplicate explicit instantiation + +extern template void f(double); // WARNING - extern not allowed +inline template class S<float>; // WARNING - inline not allowed + +template <class T> +struct S<T*> {}; + +template class S<void*>; // OK - explicit instantiation of partial + // specialization + +template <> +struct S<long double> {}; // ERROR - explicit specialization + +template class S<long double>; // ERROR - explicit instantiation after + +template <> +void f(long double) {} // ERROR - explicit specialization + +template void f(long double); // ERROR - explicit instantiation after + +template <class T> +void g(T); + +template void g(int); // ERROR - no definition of g. diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit71.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit71.C new file mode 100755 index 0000000..c84eebc --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit71.C @@ -0,0 +1,15 @@ +// Build don't link: +// by Alexandre Oliva <oliva@dcc.unicamp.br> +// Based on a testcase by Reid M. Pinchback <reidmp@MIT.EDU> +// According to the C++ Standard [temp.expl.spec]/17-18, explicit +// specializations are only valid if all enclosing template classes +// of the specialized template are fully specialized too + +template <class X> +class bug { + template <class Y> + class a {}; +}; +template <class X> +template <> // ERROR - invalid specialization +class bug<X>::a<char> {}; // ERROR - "" diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit72.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit72.C new file mode 100755 index 0000000..bc9edfb --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit72.C @@ -0,0 +1,21 @@ +// Build don't link: +// Contributed by Reid M. Pinchback <reidmp@MIT.EDU> +// Adapted by Alexandre Oliva <oliva@dcc.unicamp.br> +// plain char, signed char and unsigned char are distinct types + +template <class X, class Y> class bug {}; +template <class X> class bug<X,char> { typedef char t; }; +template <class X> class bug<X,unsigned char> { typedef unsigned char t; }; +template <class X> class bug<X,signed char> { typedef signed char t; }; +template <class X> class bug<char,X> { typedef char t; }; +template <class X> class bug<unsigned char,X> { typedef unsigned char t; }; +template <class X> class bug<signed char,X> { typedef signed char t; }; + +void foo() { + bug<int,char>::t(); + bug<int,signed char>::t(); + bug<int,unsigned char>::t(); + bug<char,int>::t(); + bug<signed char,int>::t(); + bug<unsigned char,int>::t(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit73.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit73.C new file mode 100755 index 0000000..106f573 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit73.C @@ -0,0 +1,15 @@ +// Build don't link: + +// by Alexandre Oliva <oliva@dcc.unicamp.br> + +// According to [temp.expl.spec]/2, a template explicit specialization +// must be declared in the namespace that contains the declaration of +// the template + +namespace N { + template <class T> class foo; +} + +using namespace N; + +template <> class foo<void>; // ERROR - invalid specialization - XFAIL *-*-* diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit74.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit74.C new file mode 100755 index 0000000..c49d169 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit74.C @@ -0,0 +1,10 @@ +// Reduced from a testcase by Yotam Medini <yotam@avanticorp.com> + +// egcs 1.1 seems to generate code that deletes a NULL pointer. + +template <class bar> struct foo { void fuz(); ~foo(); }; +struct baz { int i; foo<baz> j; } *p = 0; +template <class bar> void foo<bar>::fuz() { delete p; } +template <class bar> foo<bar>::~foo() { delete p; } +template class foo<baz>; +int main() { foo<baz>(); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit75.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit75.C new file mode 100755 index 0000000..433f0b1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit75.C @@ -0,0 +1,11 @@ +// Test for not complaining about mismatches during unification. +// Build don't link: + +template <void (*F)(int)> void f(); +template <void (*F)(double)> void f(); +extern void g(double); + +void h () +{ + f<g>(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit76.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit76.C new file mode 100755 index 0000000..18c161c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit76.C @@ -0,0 +1,11 @@ +// Build don't link: + +// Based on bug report by Simon A. Crase <s.crase@ieee.org> + +// crash test - XFAIL *-*-* + +struct foo { + template <class T> void bar(); +}; + +template void foo::bar<void>(); // gets bogus error - ICE - XFAIL *-*-* diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit8.C new file mode 100755 index 0000000..777c5d4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit8.C @@ -0,0 +1,13 @@ +// Build don't link: +// GROUPS passed templates +template <class T, class U> +void foo(T t, U u); + +template <class U> +void foo(double, U) {} + +void baz() +{ + foo<char*>(3.0, "abc"); + foo<char*, double>("abc", 3.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit9.C new file mode 100755 index 0000000..908374b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/explicit9.C @@ -0,0 +1,8 @@ +// Build don't link: +// GROUPS passed templates +void foo(int); + +void bar() +{ + foo<int>(3); // ERROR - foo is not a template. +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/expr1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr1.C new file mode 100755 index 0000000..cdb8687 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr1.C @@ -0,0 +1,33 @@ +template <int n> class vec { + double x[n]; + + public: + vec() { + for (int i=0; i<n-1; ++i) x[i]=0; + } + + vec(const vec<n>& v) { + for (int i=0; i<n; ++i) x[i]=v(i); + } + + vec(const vec<n-1>& v, const double& y) { + for (int i=0; i<n-1; ++i) x[i]=v(i); + x[n-1]=y; + } + + inline double operator()(const int i) const { + return x[i]; + } +}; + + +template <int n> vec<n + 1>& operator,(const vec<n>& v, const double& y) { + return *(new vec<n + 1>(v, y)); +} + + +int main() { + vec<4> v; + vec<5> w; + w=(v,3.); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/expr2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr2.C new file mode 100755 index 0000000..d6e5593 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr2.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <int I> +struct S {}; + +template <int J> +void foo(S<J + 2>); + +void bar() +{ + foo(S<3>()); // ERROR - no way to deduce J from this. +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/expr3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr3.C new file mode 100755 index 0000000..4d77370 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr3.C @@ -0,0 +1,20 @@ +// Build don't link: + +template <int I> +struct S {}; + +template <int J> +void foo(S<J - 1>); + +template <class T> +void baz(S<sizeof(T)>); + +template <int J> +void fun(S<J>, S<J * 2>); + +void bar() +{ + foo<5>(S<4>()); // OK - 4 is 5 - 1. + baz<int>(S<sizeof(int)>()); // OK + fun(S<4>(), S<8>()); // OK - deduce J from first argument. +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/expr4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr4.C new file mode 100755 index 0000000..13298fe --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr4.C @@ -0,0 +1,373 @@ +template<class View, class W> +class TinyContainer { +public: + + typedef W T_Wrapped; + + TinyContainer() { } + TinyContainer(View data) : m_data(data) { } + + T_Wrapped &unwrap() + { + return *static_cast<T_Wrapped *>(this); + } + const T_Wrapped &unwrap() const + { + return *static_cast<const T_Wrapped *>(this); + } + +protected: + + mutable View m_data; +}; + +template<class Op, class Left, class Right> +class TinyBinaryExpr : + public TinyContainer< Op, TinyBinaryExpr<Op, Left, Right> > { +public: + + typedef typename Left::T_Return T_Return; + typedef TinyBinaryExpr<Op, Left, Right> T_Expr; + + T_Expr makeExpr() const { return *this; } + + TinyBinaryExpr(const Op &op, const Left &left, const Right &right) + : TinyContainer< Op, TinyBinaryExpr<Op, Left, Right> >(op), + m_left(left), m_right(right) + { } + + TinyBinaryExpr(const Left &left, const Right &right) + : m_left(left), m_right(right) + { } + + Op op() const { return m_data; } + Left left() const { return m_left; } + Right right() const { return m_right; } + +private: + + Left m_left; + Right m_right; +}; + +struct OpAdd { + + template<class T1, class T2> + static T1 apply(const T1 &l, const T2 &r) + { + return l + r; + } + +}; + +template<class V1, class T1, class V2, class T2> +inline TinyBinaryExpr<OpAdd, typename T1::T_Expr, typename T2::T_Expr> +operator+(const TinyContainer<V1,T1>& l, const TinyContainer<V2,T2>& r) +{ + typedef TinyBinaryExpr<OpAdd, typename T1::T_Expr, typename T2::T_Expr> ret; + return ret(l.unwrap().makeExpr(), r.unwrap().makeExpr()); +} + + +template<class Op, class T1, class T2, class Functor> +inline +typename T1::T_Return +for_each(const TinyBinaryExpr<Op,T1,T2>& node, Functor f) +{ + return Op::apply(for_each(node.left(),f), for_each(node.right(),f)); +} + +template<class T, unsigned Nrows, unsigned Ncols, unsigned S1, unsigned S2> +class DenseDataView + : public TinyContainer< T*, DenseDataView<T, Nrows, Ncols, S1, S2> > { +public: + + typedef T T_Return; + typedef DenseDataView<T, Nrows, Ncols, S1, S2> T_Expr; + + T_Expr makeExpr() const { return *this; } + + T *beginLoc(unsigned i, unsigned j) const + { return m_data + S1 * i + S2 * j; } + + DenseDataView(T *pData) + : TinyContainer< T*, DenseDataView<T, Nrows, Ncols, S1, S2> >(pData) { } + + T &offset(unsigned i, unsigned j) + { + return m_data[S1 * i + S2 * j]; + } + + T offset(unsigned i, unsigned j) const + { + return m_data[S1 * i + S2 * j]; + } + + template<unsigned I, unsigned J> + struct Offset { + + static T &apply(DenseDataView<T, Nrows, Ncols, S1, S2> &d) + { + return d.m_data[S1 * I + S2 * J]; + } + + static T constApply(const DenseDataView<T, Nrows, Ncols, S1, S2> &d) + { + return d.m_data[S1 * I + S2 * J]; + } + + }; + +}; + +template<unsigned I, unsigned J> +struct Eval2 { }; + +template<class T, unsigned Nrows, unsigned Ncols, unsigned S1, unsigned S2, + unsigned I, unsigned J> +inline T +for_each(const DenseDataView<T, Nrows, Ncols, S1, S2> &d, + const Eval2<I,J> &e) +{ + return d.offset(I, J); +} + +template<class T, unsigned Nrows, unsigned Ncols> +class DenseData + : public TinyContainer< T[Nrows * Ncols], DenseData<T, Nrows, Ncols> > { +public: + + typedef T T_Return; + typedef DenseDataView<T, Nrows, Ncols, 1, Nrows> T_Expr; + + T_Expr makeExpr() const { return T_Expr(m_data); } + + T *beginLoc(unsigned i, unsigned j) const + { return &m_data[i + Nrows * j]; } + + T &operator[](unsigned i) + { + return m_data[i]; + } + + T operator[](unsigned i) const + { + return m_data[i]; + } + + T &offset(unsigned i, unsigned j) + { + return m_data[i + Nrows * j]; + } + + T offset(unsigned i, unsigned j) const + { + return m_data[i + Nrows * j]; + } + + template<unsigned I, unsigned J> + struct Offset { + + static T &apply(DenseData<T, Nrows, Ncols> &d) + { + return d.m_data[I + Nrows * J]; + } + + static T constApply(const DenseData<T, Nrows, Ncols> &d) + { + return d.m_data[I + Nrows * J]; + } + + }; + +}; + +template<class T, unsigned Nrc> +class DiagonalData { +public: + + T &offset(unsigned i, unsigned j) + { + assert(i == j); + return m_data[i]; + } + + T offset(unsigned i, unsigned j) const + { + return (i == j) ? m_data[i] : T(0); + } + + template<unsigned I, unsigned J> + struct Offset { + + static T &apply(DiagonalData<T,Nrc> &d) + { + assert(I == J); + return d.m_data[I]; + } + + static T constApply(const DiagonalData<T,Nrc> &d) + { + return (I == J) ? d.m_data[I] : T(0); + } + + }; + +private: + + T m_data[Nrc]; +}; + +template<unsigned I, unsigned J, unsigned C1> +struct InnerLoop { + + template<class LHS, class RHS> + static inline void eval(LHS &l, const RHS &r) + { + l.offset(I,J) = for_each(r, Eval2<I,J>()); + InnerLoop<I + 1, J, C1 - 1>::eval(l, r); + } + +}; + +template<unsigned I, unsigned J> +struct InnerLoop<I, J, 0> { + + template<class LHS, class RHS> + static inline void eval(LHS &, const RHS &) { } + +}; + +template<unsigned I, unsigned J, unsigned C1, unsigned C2> +struct Loop2 { + + template<class LHS, class RHS> + static inline void eval(LHS &l, const RHS &r) + { + InnerLoop<I, J, C1>::eval(l, r); + Loop2<I, J + 1, C1, C2 - 1>::eval(l, r); + } +}; + +template<unsigned I, unsigned J, unsigned C1> +struct Loop2<I, J, C1, 0> { + + template<class LHS, class RHS> + static inline void eval(LHS &l, const RHS &r) { } + +}; + + +template<unsigned Begin, unsigned End, unsigned Stride = 1> +class TinyRange { +public: + + static const unsigned b = Begin; + static const unsigned e = End; + static const unsigned s = Stride; + static const unsigned n = (End - Begin) / Stride + 1; + + static unsigned index(unsigned i) + { + return b + s * i; + } +}; + +template<class Range1, class Range2, class Data> +struct Merge { }; + +template<class Range1, class Range2, class T, unsigned Nrows, unsigned Ncols> +struct Merge<Range1, Range2, DenseData<T, Nrows, Ncols> > +{ + static const unsigned s2 = Nrows * Range2::s; + typedef + DenseDataView<T, Range1::n, Range2::n, Range1::s, s2> type; +}; + +template<class Range1, class Range2, class T, unsigned Nrows, unsigned Ncols, + unsigned S1, unsigned S2> +struct Merge<Range1, Range2, DenseDataView<T, Nrows, Ncols, S1, S2> > +{ + static const unsigned s1 = S1 * Range1::s; + static const unsigned s2 = S2 * Range2::s; + + typedef + DenseDataView<T, Range1::n, Range2::n, s1, s2> type; +}; + +template<class T, unsigned Nrows, unsigned Ncols, + class Data = DenseData<T, Nrows, Ncols> > +class TinyMatrix : + public TinyContainer< Data, TinyMatrix<T, Nrows, Ncols, Data> > { +public: + + typedef T T_Return; + typedef typename Data::T_Expr T_Expr; + typedef TinyContainer< Data, TinyMatrix<T, Nrows, Ncols, Data> > T_Base; + + T_Expr makeExpr() const { return m_data.makeExpr(); } + + TinyMatrix() { } + + TinyMatrix(const T &a0, const T &a1, const T &a2, + const T &a3, const T &a4, const T &a5) + { + m_data[0] = a0; m_data[1] = a1; m_data[2] = a2; + m_data[3] = a3; m_data[4] = a4; m_data[5] = a5; + } + + TinyMatrix(const T &a0, const T &a1) + { + m_data[0] = a0; m_data[1] = a1; + } + + TinyMatrix(const Data &d) : T_Base(d) { } + + T operator()(unsigned i, unsigned j) const + { + return m_data.offset(i, j); + } + + template<unsigned B1, unsigned E1, unsigned S1, + unsigned B2, unsigned E2, unsigned S2> + TinyMatrix<T, TinyRange<B1, E1, S1>::n, + TinyRange<B2, E2, S2>::n, + typename + Merge< TinyRange<B1, E1, S1>, TinyRange<B2, E2, S2>, Data>::type> + operator()(const TinyRange<B1, E1, S1> &r1, const TinyRange<B2, E2, S2> &r2) + { + typedef typename + Merge< TinyRange<B1, E1, S1>, TinyRange<B2, E2, S2>, Data>::type + T_DataType; + typedef TinyMatrix<T, TinyRange<B1, E1, S1>::n, + TinyRange<B2, E2, S2>::n, T_DataType> T_RetType; + + return T_RetType(T_DataType(m_data.beginLoc(B1, B2))); + } + + template<class V1, class T1> + void operator=(const TinyContainer<V1, T1> &rhs) + { + Loop2<0, 0, Nrows, Ncols>::eval(m_data, rhs.unwrap().makeExpr()); + } + +}; + + +int main() +{ + TinyMatrix<double, 2, 3> a, b(1.0, 2.0, 3.0, 4.0, 5.0, 6.0), + c(0.1, 0.2, 0.3, 0.4, 0.5, 0.6), d(0.01, 0.02, 0.03, 0.04, 0.05, 0.06); + TinyMatrix<double, 1, 2> e, f(17.0, 48.3); + + a = b + c + d; + + a(TinyRange<0,1>(), TinyRange<0,2,2>()); + + a(TinyRange<0,1>(), TinyRange<0,2,2>()) + (TinyRange<0,0>(), TinyRange<0,1>()); + + e = f + a(TinyRange<0,1>(), TinyRange<0,2,2>()) + (TinyRange<0,0>(), TinyRange<0,1>()); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/expr5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr5.C new file mode 100755 index 0000000..4cb5078 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr5.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class T, int i> +struct S1; + +template <class T, int i, int j> +struct S2 +{ + typedef typename S1<T, (i >= j ? 0 : 1) >::type type; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/expr6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr6.C new file mode 100755 index 0000000..e1d38de --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/expr6.C @@ -0,0 +1,9 @@ +// Build don't link: + +// Based on a bug report by tveldhui <tveldhui@extreme.indiana.edu> + +// excess errors test - XFAIL *-*-* + +template <int X> class foo {}; + +foo< true ? 1 : 0 > bar; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend1.C new file mode 100755 index 0000000..ba642ba --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend10.C new file mode 100755 index 0000000..bff432b --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend11.C new file mode 100755 index 0000000..d70fae6 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend12.C new file mode 100755 index 0000000..ef9bfc8 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend13.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend13.C new file mode 100755 index 0000000..251d52a --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend14.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend14.C new file mode 100755 index 0000000..4ed5fcc --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend14.C @@ -0,0 +1,25 @@ +// Build don't link: + +template <class U> +class S1 +{ + template <class T> + friend class S2; + + static int i; +}; + + +template <class T> +class S2 +{ +public: + static void f() { S1<T>::i = 3; } +}; + + +void g() +{ + S2<double>::f(); + S2<long>::f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend15.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend15.C new file mode 100755 index 0000000..8d49f6a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend15.C @@ -0,0 +1,24 @@ +// Build don't link: + +class S1 +{ + template <class T> + friend class S2; + + static int i; +}; + + +template <class T> +class S2 +{ +public: + static void f() { S1::i = 3; } +}; + + +void g() +{ + S2<double>::f(); + S2<char>::f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend16.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend16.C new file mode 100755 index 0000000..7f13e5b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend16.C @@ -0,0 +1,31 @@ +// Build don't link: + +template <class T> +class S2 +{ +public: + static void f(); +}; + + +template <class U> +class S1 +{ + template <class T> + friend class S2; + + static int i; +}; + + +template <class T> +void S2<T>::f() +{ + S1<T>::i = 3; +} + +void g() +{ + S2<double>::f(); + S2<char>::f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend17.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend17.C new file mode 100755 index 0000000..cb12ce8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend17.C @@ -0,0 +1,28 @@ +// Build don't link: + +template <class T> +class S2 +{ +public: + static void f(); +}; + +class S1 +{ + template <class T> + friend class S2; + + static int i; +}; + +template <class T> +void S2<T>::f() +{ + S1::i = 3; +} + +void g() +{ + S2<double>::f(); + S2<char>::f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend18.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend18.C new file mode 100755 index 0000000..998e163 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend18.C @@ -0,0 +1,26 @@ +// Build don't link: + +template <class U> +class S1 +{ + template <class T> + friend class S2; + + static int i; +}; + + +template <class T> +class S2 +{ +public: + static void f() { S1<T>::i = 3; } +}; + + +void g() +{ + S2<double>::f(); + S2<long>::f(); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend19.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend19.C new file mode 100755 index 0000000..998e163 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend19.C @@ -0,0 +1,26 @@ +// Build don't link: + +template <class U> +class S1 +{ + template <class T> + friend class S2; + + static int i; +}; + + +template <class T> +class S2 +{ +public: + static void f() { S1<T>::i = 3; } +}; + + +void g() +{ + S2<double>::f(); + S2<long>::f(); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend20.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend20.C new file mode 100755 index 0000000..40d5370 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend20.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class T = int> struct A; + +template <class T> struct B +{ + friend class A<T>; +}; + +template class B<int>; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend21.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend21.C new file mode 100755 index 0000000..c89fe1d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend21.C @@ -0,0 +1,30 @@ +// Build don't link: + +template <class T> struct A { + static void f(); +}; + +template <class T> class B +{ + friend class A<T>; + static int i; +}; + +template <class T> class C +{ + template <class U> + friend class A; + + static int i; +}; + +template <class T> +void A<T>::f() +{ + B<T>::i = 3; + C<T>::i = 3; + C<double>::i = 3; + B<double>::i = 3; // ERROR - member `i' is private +} + +template void A<int>::f(); // ERROR - instantiated from here diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend22.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend22.C new file mode 100755 index 0000000..ed459d7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend22.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class T = int> +struct S +{ + template <class U> + friend class S; +}; + +template struct S<int>; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend23.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend23.C new file mode 100755 index 0000000..21065f1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend23.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class T = int> // ERROR - original definition +struct S +{ // ERROR - redefinition of default arg + template <class U = int> + friend class S; +}; + +template struct S<int>; // ERROR - instantiated from here diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend24.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend24.C new file mode 100755 index 0000000..d312b38 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend24.C @@ -0,0 +1,18 @@ +// Build don't link: + +template <class T> +struct S +{ + template <class U = T> + friend class S; + + void f(T); +}; + +template struct S<int>; + +void g() +{ + S<> s; + s.f(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend25.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend25.C new file mode 100755 index 0000000..f93e73b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend25.C @@ -0,0 +1,15 @@ +// Build don't link: + +template <class T> struct A; + +struct B +{ + template <class U> + friend class A<U>; // ERROR - does not specialize any args +}; + +struct C +{ + template <class U> + friend class A<U*>; // ERROR - partial specialization +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend26.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend26.C new file mode 100755 index 0000000..a426f8b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend26.C @@ -0,0 +1,6 @@ +// Build don't link: + +struct S +{ + friend void f<>(int); // ERROR - does not match any template +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend27.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend27.C new file mode 100755 index 0000000..0f11a49 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend27.C @@ -0,0 +1,7 @@ +// Build don't link: + +class S +{ + friend void f<>(int); // ERROR - does not match any template + int i; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend28.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend28.C new file mode 100755 index 0000000..f86d0b6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend28.C @@ -0,0 +1,22 @@ +// Build don't link: + +class mystream; + +template <class T> class a { +public: + friend mystream& operator>> <>( mystream&, a<T>& thea ); +private: + T amember; +}; + +template <class T> mystream& operator>>( mystream& s, a<T>& thea ); + +template<> mystream& operator>> <int>( mystream& s, a<int>& thea ); + +template class a<int>; + +template<> mystream& operator>> <int>( mystream& s, a<int>& thea ) +{ + thea.amember = 0; + return s; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend29.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend29.C new file mode 100755 index 0000000..e141aaa --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend29.C @@ -0,0 +1,16 @@ +// Build don't link: + +template <class T> class a { +public: + friend void foo<>( a<T>& thea ); +private: + T amember; +}; + +template <class T> void foo( a<T>& thea ) +{ + thea.amember = 0; +} + +template class a<int>; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend3.C new file mode 100755 index 0000000..77aabd3 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend30.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend30.C new file mode 100755 index 0000000..61dd8fc --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend30.C @@ -0,0 +1,18 @@ +// Build don't link: + +template <class T, class U> +struct S { + template <class X, class Y, class Z> + friend X f(X, Y, Z); +}; + +template <class X, class Y, class Z> +X f(X x, Y, Z) { + return x; +} + +template char f(char, long, short); +template char* f(char*, long*, short*); +template class S<int, double>; +template class S<void*, double>; +template double* f(double*, long*, short*); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend31.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend31.C new file mode 100755 index 0000000..15a380b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend31.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <class T> +struct S1 { +}; + +template <> +struct S1<int> {}; + +struct S2 { + friend class S1<int>; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend32.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend32.C new file mode 100755 index 0000000..b1f173a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend32.C @@ -0,0 +1,16 @@ +// Build don't link: + +template <class T, class U> +struct S { + template <class X, class Y, class Z> + friend X f(X, Y, Z); +}; + +template class S<int, double>; +template char f(char, long, short); +template char* f(char*, long*, short*); + +template <class X, class Y, class Z> +X f(X x, Y, Z) { + return x; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend33.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend33.C new file mode 100755 index 0000000..5feec1a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend33.C @@ -0,0 +1,28 @@ +// Build don't run: +// Special g++ Options: -g + +template <class P1> +struct S1 +{ + struct SS1 + { + }; + friend void Foo (const SS1& ss1) + { + } +}; + +template <class P1> +void Foo(const S1<P1>& s1) +{ + typedef typename S1<P1>::SS1 TYPE; + TYPE t; + Foo(t); +} + +int main () +{ + S1<double> obj; + Foo(obj); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend34.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend34.C new file mode 100755 index 0000000..56eb80a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend34.C @@ -0,0 +1,15 @@ +// Build don't link: +// excess errors test + +// This testcase won't fail if class ::foo is forward-declared in the +// global namespace, nor if class bar is not a template class. + +template <typename T = void> +class bar { +public: + friend class foo; // this is not bar::foo, it forward-declares ::foo + class foo {}; + bar() { foo(); } // but this should refer to bar::foo +}; + +bar<> baz; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend35.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend35.C new file mode 100755 index 0000000..c2c22c7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend35.C @@ -0,0 +1,7 @@ +// Build don't link: + +class foo { + friend void bar<int>(int); // ERROR - must be declared first +}; + +template <typename T> void bar(T); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend36.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend36.C new file mode 100755 index 0000000..4a9042a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend36.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <class T> +void f(T) {} // ERROR - previously defined here + +template <class U> +struct S { + template <class T> + friend void f(T) {} // ERROR - redeclaration +}; + +S<int> si; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend37.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend37.C new file mode 100755 index 0000000..2379d5f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend37.C @@ -0,0 +1,8 @@ +// Build don't link: +// Simplified from report by Volker Dobler <volker@hugo.physik.uni-konstanz.de> + +// crash test - XFAIL *-*-* + +template <class T> class A { + friend int ice<>( int k=0 ); // ERROR - undeclared +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend38.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend38.C new file mode 100755 index 0000000..41c7714 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend38.C @@ -0,0 +1,10 @@ +// Build don't link: + +// Overly simplified from testcase by "B. K. Oxley" <binkley@bigfoot.com> + +// crash test - XFAIL *-*-* + +template<class P> struct foo { + typedef P parent_type; + friend parent_type; // ERROR - template parameters cannot be friends +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend39.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend39.C new file mode 100755 index 0000000..836c830 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend39.C @@ -0,0 +1,23 @@ +// Build don't link: + +template <class T> +struct S; + +template <class T> +class C +{ + friend void S<T>::f(); + + int i; +}; + +template <class T> +struct S +{ + void f() { + C<T> c; + c.i = 3; + } +}; + +template void S<int>::f(); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/friend4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend4.C new file mode 100755 index 0000000..ea43927 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend5.C new file mode 100755 index 0000000..516be4d --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend6.C new file mode 100755 index 0000000..5651421 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend7.C new file mode 100755 index 0000000..2962d92 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend8.C new file mode 100755 index 0000000..ffa9122 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/friend9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/friend9.C new file mode 100755 index 0000000..63455d0 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/goto.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/goto.C new file mode 100755 index 0000000..c6c1a56 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/goto.C @@ -0,0 +1,12 @@ +// Build don't link: + +template<class T> +void compute(T) { + goto Exit; +Exit: ; + } + +int main() +{ + compute(0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate1.C new file mode 100755 index 0000000..11f9c78 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/instantiate2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate2.C new file mode 100755 index 0000000..a5c6c49 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/instantiate3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate3.C new file mode 100755 index 0000000..62062f7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate3.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class T> +struct S +{ + S(const T&) {} + S(int, long); +}; + +template S<double>::S(const double&); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate4.C new file mode 100755 index 0000000..296356b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate4.C @@ -0,0 +1,27 @@ +// Build then link: + +// Special g++ Options: -frepo -Werror + +// Submitted by Melissa O'Neill <oneill@cs.sfu.ca> +// the vtable of Foo<int> wouldn't be generated + +template <typename A> +struct Foo { + virtual void foo() {} +}; + +template <typename A> +struct Bar { + void bar(); +}; + +template <typename A> +void Bar<A>::bar() { + Foo<A> oof; +} + +int main () { + Bar<int> rab; + + rab.bar(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate5-main.cc b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate5-main.cc new file mode 100755 index 0000000..be64bdb --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate5-main.cc @@ -0,0 +1,3 @@ +// this file is part of testcase instantiate5.C + +int main() {} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate5.C new file mode 100755 index 0000000..70eefcb --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate5.C @@ -0,0 +1,14 @@ +// Build don't run: + +// Additional sources: instantiate5.cc instantiate5-main.cc + +// `global constructors' are given the same name, based on foo(), on +// both translation units, which is wrong, because it must be possible +// to define template functions in multiple translation units, as long +// as they're given the same definition + +// simplified from test case submitted by Daniel X. Pape <dpape@canis.uiuc.edu> + +template <class T> void foo() { } +inline int bar() { foo<void>(); return 1; } +static int i = bar(); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate5.cc b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate5.cc new file mode 100755 index 0000000..fc86e0f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate5.cc @@ -0,0 +1,5 @@ +// this file is part of testcase instantiate5.C + +template <class T> void foo() { } +inline int bar() { foo<void>(); return 1; } +static int i = bar(); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate6.C new file mode 100755 index 0000000..e896ed3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/instantiate6.C @@ -0,0 +1,26 @@ +// Build then link: +// Special g++ Options: -frepo + +// Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il> +// excess errors test - XFAIL *-*-* + +template <class T> +class foo{ +public: + void g(); + void h(); +}; + +template <class T> +void foo<T>::g() { + h(); +} + +template <class T> +void foo<T>::h() { +} + +int main() { + foo<int> f; + f.g(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/label1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/label1.C new file mode 100755 index 0000000..964d1d7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/label1.C @@ -0,0 +1,25 @@ +// Build don't link: + +template <class T> +struct S {}; + +template <class T> +inline void g(T t) +{ + here: + S<T> st; + goto here; +} + +template <class T> +void f(T t) +{ + here: + g(t); + goto here; +} + +void h() +{ + f(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/local1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/local1.C new file mode 100755 index 0000000..1b9e515 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/local2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/local2.C new file mode 100755 index 0000000..4aafc69 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/local3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/local3.C new file mode 100755 index 0000000..ea1b386 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/local3.C @@ -0,0 +1,26 @@ +extern "C" void abort(); + +template <class T> +void f(T) +{ + int j; + + j = 6; + + struct S { + int i; + }; + + S s; + + s.i = j; + + if (s.i != 6) + abort(); +} + + +int main() +{ + f(7); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/local4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/local4.C new file mode 100755 index 0000000..6a7eb34 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/local5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/local5.C new file mode 100755 index 0000000..b49525c --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/local6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/local6.C new file mode 100755 index 0000000..d3f2f4c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/local6.C @@ -0,0 +1,24 @@ +extern "C" void abort(); + +template <class T> +int f(T) +{ + struct S1 { + virtual int foo() { return 1; } + }; + + struct S2 : public S1 { + int foo() { return 2; } + }; + + S1* s2 = new S2; + + return s2->foo(); +} + + +int main() +{ + if (f(3) != 2) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup1.C new file mode 100755 index 0000000..359915c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup1.C @@ -0,0 +1,14 @@ +// Build don't link: + +template <class T, class Allocator> + struct __vector_alloc_base +{ + typedef int allocator_type; +}; + +template <class T> + struct vector : __vector_alloc_base<T,int> +{ + typedef short allocator_type; + explicit vector(const allocator_type& a = allocator_type()) {} +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup2.C new file mode 100755 index 0000000..169aee0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup2.C @@ -0,0 +1,20 @@ +// Build don't link: +// Special g++ Options: + +class A +{ +protected: + void f1() {}; +}; + +template <class T> class B : private A { +protected: + using A::f1; +}; + +template <class T> class D : private B<T> +{ +public: + void f2() { f1(); }; +}; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup3.C new file mode 100755 index 0000000..9ada72f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup3.C @@ -0,0 +1,17 @@ +template<class T> +class A { +public: + void f() { } +}; + +class B : public A<int> { +public: + void f(); +}; + +int main() +{ + B b; + B& b1 = b; + b1.A<int>::f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup4.C new file mode 100755 index 0000000..fe15252 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup4.C @@ -0,0 +1,24 @@ +// Build don't link: + +void h(int); + +template <class T> +class i {}; + +struct B +{ + int i; +}; + +template <class T> +struct D : public B +{ + void f(); + void g() { h(i); } +}; + +template <class T> +void D<T>::f() +{ + h(i); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup5.C new file mode 100755 index 0000000..e38b222 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup5.C @@ -0,0 +1,14 @@ +// Build don't link: + +struct B { + int i; +}; + +struct D: public B { + int i; +}; + +template <class T> +struct D2 : public D { + void f() { i = 3; } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup6.C new file mode 100755 index 0000000..ae1f5ca --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/lookup6.C @@ -0,0 +1,15 @@ +// Build don't link: + +// Based on bug report by Miniussi <miniussi@ilog.fr> + +class t {}; + +template <class T> struct A { typedef T t; typedef T u; }; + +template <class T> struct B : public A<T> { + // according to [temp.dep.type], `t' and `u' cannot be dependent types, + // and so there's no reason to delay lookup to specialization time. + void f(t p); // this is ::t [temp.dep]/3 + void f(typename A<T>::t p); // gets bogus error - redefinition + void g(u p); // ERROR - unknown type name +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m1.C new file mode 100755 index 0000000..7de0e0c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m1.C @@ -0,0 +1,16 @@ +// Build don't link: + +int f1 () { + struct A { + A() : b (2) { } + int fred () { return b.hi_mom; } + struct B { + int hi_mom; + B (int a) { hi_mom = a; } + }; + B b; + }; + A aa; + return aa.fred(); +} +/* crashes with signal 11 */ diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m2.C new file mode 100755 index 0000000..00fdbad --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m2.C @@ -0,0 +1,9 @@ +// Build don't link: + +struct A { A() { a = 2; } int a; }; + +int f1 () { + struct A { A() { a = 2; } int a; }; + A aa; + return aa.a; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m3.C new file mode 100755 index 0000000..492b261 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m3.C @@ -0,0 +1,9 @@ +// Build don't link: + +struct A { A() { a = 2; } int a; }; + +struct B { + struct A { A() { a = 2; } int a; }; + A aa; +}; +char xx[]="../tests/m3.cc:4: redefinition of `struct A'"; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m4.C new file mode 100755 index 0000000..bbfb227 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m4.C @@ -0,0 +1,7 @@ +// Build don't link: + +struct A1 { struct B { B(); } b; }; +struct A2 { struct B { ~B(); } b; }; +char xx[] ="../tests/m4.cc:1: warning: return type specification for constructor invalid"; + + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m5.C new file mode 100755 index 0000000..e834970 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m5.C @@ -0,0 +1,6 @@ +// Build don't link: + +struct B { struct A { A(); int a; } aa; }; +struct A { A(); int a; }; +B::A::A () { a = 37; } +char xx[]="../tests/m5.cc:3: Segmentation violation"; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m6.C new file mode 100755 index 0000000..5d0c81e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m6.C @@ -0,0 +1,14 @@ +// Build don't link: + +struct B { struct A { A(); int a; } aa; }; +B::A::A () { a = 37; } +char* xx[] = { +"../tests/m6.cc:1: warning: return type specification for constructor invalid", +"../tests/m6.cc:2: semicolon missing after declaration of `A'", +"../tests/m6.cc:2: warning: empty declaration", +"../tests/m6.cc: In function int A ():", +"../tests/m6.cc:2: `a' undeclared (first use this function)", +"../tests/m6.cc:2: (Each undeclared identifier is reported only once", +"../tests/m6.cc:2: for each function it appears in.)", +"../tests/m6.cc:2: warning: control reaches end of non-void function" }; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m7.C new file mode 100755 index 0000000..06d2ba3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m7.C @@ -0,0 +1,13 @@ +// Build don't link: + +struct B { struct A { A(); int a; }; A aa; }; +B::A::A () { a = 37; } +char *xx[]= {"/*", +"../tests/m7.cc:1: warning: return type specification for constructor invalid", +"../tests/m7.cc: In function struct A A ():", +"../tests/m7.cc:2: `a' undeclared (first use this function)", +"../tests/m7.cc:2: (Each undeclared identifier is reported only once", +"../tests/m7.cc:2: for each function it appears in.)", +"../tests/m7.cc:2: warning: control reaches end of non-void function", + "*/" }; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m8.C new file mode 100755 index 0000000..22d0144 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m8.C @@ -0,0 +1,22 @@ +// Build don't link: + +class A { + int a; + public: + A (int aa = 3); +}; + +class B { + class A { + public: + A (int, int); + }; + A aa; + public: + B (int); +}; + +extern void foo(); +B::B (int z) : aa (1, z) { + foo (); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m9.C new file mode 100755 index 0000000..d519dbd --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m9.C @@ -0,0 +1,16 @@ +// Build don't link: + +struct A { A() { a = 1; } int a; }; +struct Q { + struct A { A() { a = 2; } int a; }; + struct R { + struct A { A() { a = 3; } int a; }; + A aaz; + }; + R rrr; + A aay; +} +; + +Q qqq; +A aav; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/m9a.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/m9a.C new file mode 100755 index 0000000..9118306 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/m9a.C @@ -0,0 +1,5 @@ +// Build don't link: + +struct A { A() { a = 1; } int a; }; // ERROR - +struct A { A() { a = 2; } int a; }; // ERROR - +A aavv; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass1.C new file mode 100755 index 0000000..5ad839c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass1.C @@ -0,0 +1,13 @@ +template <class T> struct A { + template <class U> struct B { + template <class V> void f (V) { } + void g () { } + }; +}; + +int main () +{ + A<int>::B<char> b; + b.f (42); + b.g (); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass10.C new file mode 100755 index 0000000..1deb380 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass10.C @@ -0,0 +1,10 @@ +// Build don't link: + +struct S1 +{ + template <class T> + struct S2 {}; // ERROR - previous definition + + template <class T> + struct S2 {}; // ERROR - redefinition +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass11.C new file mode 100755 index 0000000..6eee67a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass11.C @@ -0,0 +1,14 @@ +// Build don't link: + +struct S1 +{ + template <class T> + struct S2; + + template <class T> + struct S2 { + enum E { a }; + }; +}; + +int i = (int) S1::S2<double>::a; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass12.C new file mode 100755 index 0000000..f4d0354 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass12.C @@ -0,0 +1,6 @@ +// Build don't link: + +struct outer { + template <class T> struct inner; +} o; +template <class T> struct outer::inner {}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass13.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass13.C new file mode 100755 index 0000000..7eddc27 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass13.C @@ -0,0 +1,16 @@ +// Build don't link: + +template <class X, class Y> +struct Inner; + +template <class T> +struct S +{ + template <class U> + struct Inner + { + }; +}; + + +S<double>::Inner<int> si; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass14.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass14.C new file mode 100755 index 0000000..ad1b2b4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass14.C @@ -0,0 +1,15 @@ +// Build don't link: + +template <class X, class Y> +struct Inner; + +struct S +{ + template <class U> + struct Inner + { + }; +}; + + +S::Inner<int> si; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass15.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass15.C new file mode 100755 index 0000000..52f92bf --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass15.C @@ -0,0 +1,27 @@ +// Build don't link: + +template <class T> +struct S1 +{ + template <class U> + struct S2 {}; + + template <class X, class Y, class Z> + void f(X, Y, Z) + { + S2<Z> s2z; + } + + template <class X, class Z> + void g(X, Z) + { + S2<Z> s2z; + } +}; + + +void h() +{ + S1<int> si; + si.g(3, 4); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass16.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass16.C new file mode 100755 index 0000000..e8e5643 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass16.C @@ -0,0 +1,13 @@ +// Build don't link: + +template <class Q> +class A { +public: + + typedef enum { X, Y } B; + template <B c> class Traits{ }; +}; + + +template class A<int>; +template class A<double>::Traits<A<double>::X>; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass17.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass17.C new file mode 100755 index 0000000..96024e2 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass17.C @@ -0,0 +1,22 @@ +// Build don't link: + +template <class T> struct S +{ + template <class U> struct I + { + }; + + S(); + S(S& s); + S(I<T>); + + template <class U> operator I<U>(); +}; + +S<int> f(); +void g(S<int>); + +void h() +{ + g(f()); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass18.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass18.C new file mode 100755 index 0000000..bb7f6f1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass18.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T> struct A { + template <class U> struct B; +}; + +template <class T> template <class U> struct A<T>::B { }; + +A<int>::B<int> b; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass19.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass19.C new file mode 100755 index 0000000..6a8b0a7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass19.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T> struct A { + template <class U> struct B; +}; + +template <class T> template <class U> struct A<T>::B<U*> { }; + +A<int>::B<int*> b; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass2.C new file mode 100755 index 0000000..895fd61 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass2.C @@ -0,0 +1,18 @@ +template <class T> struct A { + template <class U> struct B { + template <class V> void f (V) { } + void g () { } + }; + template <class W> struct B<W*> { + void h () { } + }; +}; + +int main () +{ + A<int>::B<char> b; + b.f (42); + b.g (); + A<double>::B<void*> b2; + b2.h (); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass3.C new file mode 100755 index 0000000..77744f8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass3.C @@ -0,0 +1,21 @@ +template <class T> struct A { + template <class U> struct B { + template <class V> struct C { + template <class W> struct D { + template <class X> struct E { + template <class Y> struct F { + template <class Z> void f (Z) { } + void g () { } + }; + }; + }; + }; + }; +}; + +int main () +{ + A<int>::B<int>::C<int>::D<int>::E<int>::F<int> b; + b.f (42); + b.g (); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass4.C new file mode 100755 index 0000000..4c101c6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass4.C @@ -0,0 +1,23 @@ +#include <typeinfo> + +template <class T> +struct allocator { + typedef T* pointer; + + template <class U> struct rebind { + typedef allocator<U> other; + }; +}; + +template <class T, class Allocator> +struct alloc_traits +{ + typedef typename Allocator::template rebind<T>::other allocator_type; +}; + +int main () +{ + typedef alloc_traits<int, allocator<void> >::allocator_type at; + + return typeid (at) != typeid (allocator <int>); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass5.C new file mode 100755 index 0000000..06a1413 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass5.C @@ -0,0 +1,22 @@ +template <class T> struct A { + template <class U> struct B { + template <class V> static void f () { } + void g () { } + }; +}; + +template <class T, class U> +void f () +{ + A<T>::template B<U>::template f<T> (); + typename A<T>::B<U> b; + typename A<T>::template B<U> b2; + b.A<T>::template B<U>::~B(); +} + +template <class T> struct C: public A<T>::B<T> { }; + +int main () +{ + f<int, char>(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass6.C new file mode 100755 index 0000000..65de1d1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass6.C @@ -0,0 +1,18 @@ +// Compiler: egcs-2.91.12 980302 +// Error: compiler error in ctor of 'foo::bar<T>::bar(T const &)' + +struct foo +{ + template <typename T> + struct bar + { + bar(T const &t) : tt(t) {} + T tt; + }; +}; + +int main() +{ + foo::bar<int> fb(3); + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass7.C new file mode 100755 index 0000000..1a5cabe --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass7.C @@ -0,0 +1,18 @@ +struct S +{ + template <class U> + struct Y { + template <class T> + void foo(T t); + }; +}; + +template <> +template <> +void S::Y<char>::foo<int>(int i) { } + +int main() +{ + S::Y<char> s; + s.template foo<int>(3.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass8.C new file mode 100755 index 0000000..431d41d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass8.C @@ -0,0 +1,11 @@ +// Build don't link: + +template <class T> +class S +{ + template <class U> + struct S2 { + S2(const S2<U>& s2u) {} + }; +}; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass9.C new file mode 100755 index 0000000..824ee76 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memclass9.C @@ -0,0 +1,32 @@ +// Build don't link: + +template <class T> +struct S1 +{ + template <class U> + struct S2 + { + S2(U); + + void g() + { + S2<U> s2u (u); + } + + U& u; + }; + + template <class U> + void f(U u) + { + S2<U> s2u(u); + s2u.g(); + } +}; + +void g() +{ + S1<int> s1; + s1.f(3.0); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp1.C new file mode 100755 index 0000000..94274e5 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp1.C @@ -0,0 +1,15 @@ +// Build don't link: +// GROUPS passed templates membertemplates +struct S { + template <class T> + void foo(T&); +}; + + +template <class T> +void S::foo(T&) +{ +} + + + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp10.C new file mode 100755 index 0000000..9e97b5e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp10.C @@ -0,0 +1,24 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S { + template <class T> + operator T*(); +}; + + +template <class T> +S::operator T*() +{ + printf("Hello, world.\n"); + return 0; +} + + +int main() +{ + S s; + + char* cp = s.operator char*(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp11.C new file mode 100755 index 0000000..a0d681d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp11.C @@ -0,0 +1,27 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S +{ + template <class U> + S(U u, int i) {} + + template <class T> + T foo(T t) + { + printf("Hello, world.\n"); + return t; + } +}; + + +int main() +{ + S s(3, 4); + int i = s.foo(3); + s.foo("hello"); + s.foo(s); + + S s2("hello", 5); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp12.C new file mode 100755 index 0000000..94a8c3c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp12.C @@ -0,0 +1,13 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <class T> +struct S +{ + template <class U> + void foo(U); +}; + +void f() +{ + S<int> s; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp13.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp13.C new file mode 100755 index 0000000..d6bc7b9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp13.C @@ -0,0 +1,15 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <class T> +struct S +{ + template <class U> + void foo(U); +}; + +void f() +{ + S<int> s; + s.foo(3); + s.foo("hello"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp14.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp14.C new file mode 100755 index 0000000..e24a3a7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp14.C @@ -0,0 +1,30 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" const char* printf(const char*, ...); + +template <class T> +struct S +{ + template <class U, class V> + void foo(U, V); +}; + + +template <class T> +template <class U, class V> +void S<T>::foo(U, V) +{ + printf("Hello, world.\n"); +} + + +int main() +{ + S<int> s; + s.foo(3, 3); + s.foo("hello", s); + + S<char*> s2; + s2.foo(3, 3); + s2.foo("hello", s); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp15.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp15.C new file mode 100755 index 0000000..140730b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp15.C @@ -0,0 +1,16 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <class T> +struct S +{ + template <class U> + void foo(U) {} +}; + + +void f() +{ + S<int> s; + s.foo(3); + s.foo("hello"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp16.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp16.C new file mode 100755 index 0000000..cfa66aa --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp16.C @@ -0,0 +1,30 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class U> +struct S { + template <class T> + void operator+(T); +}; + +template <class U> +template <class T> +void S<U>::operator+(T) +{ + printf("Hello, world.\n"); +} + + +int main() +{ + S<int> s; + s + 3; + s + s; + s.operator+("Hi"); + + S<S<int> > s2; + s2 + 3; + s2 + s; + s2.operator+("Hi"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp17.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp17.C new file mode 100755 index 0000000..0816b36 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp17.C @@ -0,0 +1,26 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class V> +struct S { + template <class T, class U> + S(T, U, T); +}; + + +template <class V> +template <class T, class U> +S<V>::S(T t1, U u1, T t2) +{ + printf("Hello, world.\n"); +} + + +int main() +{ + S<int> s1(3, "abc", 3); + S<int> s2('a', s1, 'a'); + + S<char> s3("abc", 3, "abc"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp18.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp18.C new file mode 100755 index 0000000..638e5e3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp18.C @@ -0,0 +1,16 @@ +// Build don't link: +// GROUPS passed templates membertemplates +struct S +{ + template <class T> + void foo(T) {} +}; + +template void S::foo(int); + +int main() +{ + S s; + s.foo(3); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp19.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp19.C new file mode 100755 index 0000000..8551531 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp19.C @@ -0,0 +1,25 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S { + template <class T> + operator T(); +}; + +template <class T> +S::operator T() +{ + printf("Hello, world.\n"); + return T(); +} + + +template S::operator int(); + +int main() +{ + S s; + + int i = s.operator int(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp2.C new file mode 100755 index 0000000..e000ffa --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp2.C @@ -0,0 +1,15 @@ +// Build don't link: +// GROUPS passed templates membertemplates +struct S { + template <class T> + void foo(T&); +}; + + +template <class U> +void S::foo(U&) +{ +} + + + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp20.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp20.C new file mode 100755 index 0000000..a79c534 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp20.C @@ -0,0 +1,43 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S +{ + template <class T, class U> + void foo(T t, U u); + + template <class U> + void foo(char*, U); + + void foo(int i); +}; + +template <class T, class U> +void S::foo(T t, U u) +{ + printf ("T,U version\n"); +} + + +template <class U> +void S::foo(char*, U u) +{ + printf ("char*,U version\n"); +} + + +void S::foo(int i) +{ + printf ("int version\n"); +} + + +int main() +{ + S s; + s.foo(3); + s.foo(3, 3); + s.foo("abc", s); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp23.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp23.C new file mode 100755 index 0000000..5310b62 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp23.C @@ -0,0 +1,24 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class X> +struct S +{ + S() + { printf ("In S::S()\n"); f(3); } + + S(char) + { printf ("In S::S(char)\n"); f(*this); } + + template <class U> + void f(U u) + { printf ("In S::f(U)\nsizeof(U) == %d\n", sizeof(u)); } + + int c[16]; +}; + +int main() +{ + S<char*> s; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp24.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp24.C new file mode 100755 index 0000000..b1bfac1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp24.C @@ -0,0 +1,25 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class X> +struct S +{ + S() + { printf ("In S::S()\n"); f(3); } + + S(char) + { printf ("In S::S(char)\n"); f(*this); } + + template <class U> + void f(U u) + { printf ("In S::f(U)\nsizeof(U) == %d\n", sizeof(u)); } + + int c[16]; +}; + +int main() +{ + S<char*> s; + S<char*> s2('a'); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp25.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp25.C new file mode 100755 index 0000000..672a9c8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp25.C @@ -0,0 +1,20 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class X> +struct S +{ + template <class U> + void f(U u) { printf ("%d\n", sizeof (U)); } + + int i[4]; +}; + + +int main() +{ + S<char*> s; + s.f(3); + s.f(s); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp26.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp26.C new file mode 100755 index 0000000..cbfc93e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp26.C @@ -0,0 +1,28 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class X> +struct S +{ + template <class U> + void f(U u); + + int i[4]; +}; + + +template <class X> +template <class U> +void S<X>::f(U u) +{ + printf ("%d\n", sizeof (U)); +} + + +int main() +{ + S<char*> s; + s.f(3); + s.f(s); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp27.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp27.C new file mode 100755 index 0000000..b1bfac1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp27.C @@ -0,0 +1,25 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class X> +struct S +{ + S() + { printf ("In S::S()\n"); f(3); } + + S(char) + { printf ("In S::S(char)\n"); f(*this); } + + template <class U> + void f(U u) + { printf ("In S::f(U)\nsizeof(U) == %d\n", sizeof(u)); } + + int c[16]; +}; + +int main() +{ + S<char*> s; + S<char*> s2('a'); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp28.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp28.C new file mode 100755 index 0000000..37e79c8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp28.C @@ -0,0 +1,27 @@ +extern "C" void abort(); + +int k; + +template <class X> +struct S +{ + template <class U> + void f(U u) + { ++k; g(u); } + + template <class U> + void g(U u) + { ++k; } + + int c[16]; +}; + +int main() +{ + S<char*> s; + s.f(3); + s.f("adf"); + + if (k != 4) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp29.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp29.C new file mode 100755 index 0000000..4000070 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp29.C @@ -0,0 +1,32 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class X> +struct S +{ + template <class U> + void f(U u); + + template <class U> + void g(U U); + + int c[16]; +}; + +template <class X> +template <class U> +void S<X>::f(U u) + { printf ("In S::f(U)\n"); g(u); } + +template <class X> +template <class U> +void S<X>::g(U u) + { printf ("In S::g(U)\n"); } + +int main() +{ + S<char*> s; + s.f(3); + s.f("adf"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp3.C new file mode 100755 index 0000000..2a4dbb8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp3.C @@ -0,0 +1,24 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S { + template <class T> + void foo(T); +}; + + +template <class T> +void S::foo(T) +{ + printf("Hello, world.\n"); +} + + + +int main() +{ + S s; + s.foo(3); + s.foo(s); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp30.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp30.C new file mode 100755 index 0000000..923ec85 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp30.C @@ -0,0 +1,17 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class X> +struct S +{ + template <class U> + void g(U u) { this; } +}; + + +int main() +{ + S<char*> s; + s.g(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp31.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp31.C new file mode 100755 index 0000000..3bb1cd3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp31.C @@ -0,0 +1,16 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S +{ + template <class U> + void g(U u) + { this; } +}; + +int main() +{ + S s; + s.g(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp32.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp32.C new file mode 100755 index 0000000..3f0bfc7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp32.C @@ -0,0 +1,18 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S +{ + template <class U> + void g(U u) + { i = 3; } + + int i; +}; + +int main() +{ + S s; + s.g(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp33.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp33.C new file mode 100755 index 0000000..500abe0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp33.C @@ -0,0 +1,19 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class T> +struct S +{ + template <class U> + void g(U u) + { i; } + + int i; +}; + +int main() +{ + S<char> s; + s.g(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp34.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp34.C new file mode 100755 index 0000000..29e1101 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp34.C @@ -0,0 +1,16 @@ +// Build don't run: +// GROUPS passed templates membertemplates +template <class T> +struct S +{ + template <class U> + static void f(U u) + {} +}; + +int main() +{ + S<int>::f(3); + S<char>::f("abc"); + S<int>::f("abc"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp35.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp35.C new file mode 100755 index 0000000..7603d94 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp35.C @@ -0,0 +1,21 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <class T> +struct S +{ + S(const S& s) {} + + template <class U> + S(S<U>& s) + { + S<U> s2(s); + } +}; + + +extern S<int>& si; + +void foo() +{ + S<char*> sc(si); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp36.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp36.C new file mode 100755 index 0000000..6c57a97 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp36.C @@ -0,0 +1,21 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <class X> +struct R +{ +}; + + +template <class T> +struct S +{ + template <class U> + S(R<U> r); +}; + + +void foo() +{ + R<int> r; + S<char*> s(r); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp37.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp37.C new file mode 100755 index 0000000..186083b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp37.C @@ -0,0 +1,20 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <class T> +struct S +{ + template <class U> + void f(U u); +}; + + +template <class T> +template <class U> +void S<T>::f(U) +{ +} + +enum +{ + a = 3 +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp39.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp39.C new file mode 100755 index 0000000..146d329 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp39.C @@ -0,0 +1,17 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <class T> +struct S +{ + template <class U> + void f(U u) { g(u); } + + template <class U> + void g(U u) { f(u); } +}; + +void foo() +{ + S<int> si; + si.f(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp4.C new file mode 100755 index 0000000..b9f9c16 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp4.C @@ -0,0 +1,12 @@ +// Build don't link: +// GROUPS passed templates membertemplates +struct S { + template <class T> + void operator+(T); +}; + + +template <class T> +void S::operator+(T) +{ +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp40.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp40.C new file mode 100755 index 0000000..70506f0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp40.C @@ -0,0 +1,21 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <class T> +struct R +{ + template <class U> + void g(U u) {} +}; + +template <class T> +struct S +{ + template <class U> + void f(U u) { R<T> r; r.g(u); } +}; + +void foo() +{ + S<int> si; + si.f("abc"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp41.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp41.C new file mode 100755 index 0000000..603f702 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp41.C @@ -0,0 +1,7 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <int i> +struct S +{ + static void foo() {} +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp42.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp42.C new file mode 100755 index 0000000..3c11dd4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp42.C @@ -0,0 +1,22 @@ +// Build don't run: +// GROUPS passed templates membertemplates +template<class T, int N> +class Foo { + +public: + template<int N2> + Foo<T,N> operator=(const Foo<T,N2>& z) + { + return Foo<T,N>(); + } +}; + +int main() +{ + Foo<double,4> x; + Foo<double,7> y; + x = y; + + return 0; +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp43.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp43.C new file mode 100755 index 0000000..3d8e3ad --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp43.C @@ -0,0 +1,16 @@ +// Build don't run: +// GROUPS passed templates membertemplates +template<class T, int N> +class A +{ +public: + template<class U> + void operator=(A<U, N> const & a) { return; } +}; + +int main() +{ + A<float, 3> a; + A<double, 3> b; + a = b; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp44.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp44.C new file mode 100755 index 0000000..c8d6f16 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp44.C @@ -0,0 +1,20 @@ +// Build don't run: +// GROUPS passed templates membertemplates +template<class T> +class A +{ +}; + +template<> +class A<float> +{ +public: + template<class U> + void func(U v1) {} +}; + +int main() +{ + A<float> a; + a.func(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp45.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp45.C new file mode 100755 index 0000000..d71f25d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp45.C @@ -0,0 +1,20 @@ +// Build don't run: +// GROUPS passed templates membertemplates +template<class T> +class A +{ +}; + +template<> +class A<float> +{ +public: + template<class U> + void func(U v1 = 0) {} +}; + +int main() +{ + A<float> a; + a.func(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp46.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp46.C new file mode 100755 index 0000000..2212a52 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp46.C @@ -0,0 +1,20 @@ +// Build don't run: +// GROUPS passed templates membertemplates +template<class T, class U> +class A +{ +}; + +template<class U> +class A<float, U> +{ +public: + template <class V> + void func(V v1 = 0) {} +}; + +int main() +{ + A<float, int> a; + a.func("abc"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp47.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp47.C new file mode 100755 index 0000000..e4f7ebf --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp47.C @@ -0,0 +1,29 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +template <class X> +struct S +{ + template <class U> + void g(U u) + { printf ("In S::g(U)\n"); } + + int c[16]; +}; + + +template <class X> +struct T : public S<X> +{ + template <class U> + void f(U u) + { printf ("In T::f(U)\n"); g(u); } +}; + +int main() +{ + T<char*> t; + t.f(3); + t.f("adf"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp48.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp48.C new file mode 100755 index 0000000..8ce6f66 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp48.C @@ -0,0 +1,15 @@ +// Build don't link: +// GROUPS passed templates membertemplates +struct S +{ + template <class T> + void f(T t1, T t = T()) + {} +}; + + +void foo() +{ + S si; + si.f(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp49.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp49.C new file mode 100755 index 0000000..f2d610f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp49.C @@ -0,0 +1,16 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <class X> +struct S +{ + template <class T> + void f(T t1, T t = T()) + {} +}; + + +void foo() +{ + S<int> si; + si.f(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp5.C new file mode 100755 index 0000000..14647a3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp5.C @@ -0,0 +1,25 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S { + template <class T> + void operator+(T); +}; + + +template <class T> +void S::operator+(T) +{ + printf("Hello, world.\n"); +} + + + +int main() +{ + S s; + s + 3; + s + s; + s.operator+("Hi"); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp52.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp52.C new file mode 100755 index 0000000..25dc7e7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp52.C @@ -0,0 +1,20 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template<class T, int N> +class A { }; + +template<int N> +struct X { + template<class T2, int N2> + void f(A<T2,N>&, A<int,N2>&) + { } +}; + + +void foo() +{ + X<3> x; + A<char*, 3> a1; + A<int, 2> a2; + x.f(a1, a2); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp53.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp53.C new file mode 100755 index 0000000..4fd65b9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp53.C @@ -0,0 +1,36 @@ +// Build don't run: +// GROUPS passed templates membertemplates +template<int N> +struct I { +}; + +template<class T> +struct A { + + int r; + + template<class T1, class T2> + void operator()(T1, T2) + { r = 0; } + + template<int N1, int N2> + void operator()(I<N1>, I<N2>) + { r = 1; } +}; + +int main() +{ + A<float> x; + I<0> a; + I<1> b; + + x(a,b); + if (x.r != 1) + return 1; + + x(float(), double()); + if (x.r != 0) + return 1; + + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp55.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp55.C new file mode 100755 index 0000000..b955189 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp55.C @@ -0,0 +1,10 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template<class X> class _bz_update { }; + +template<class T> +struct S { +template<int N_destRank> +void foo() { _bz_update<int>(); } +}; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp56.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp56.C new file mode 100755 index 0000000..ef6b286 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp56.C @@ -0,0 +1,15 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template<class P_numtype, int N_length> +class TinyVector {}; + +template<class P_numtype, int N_rank> +struct Array +{ + template<int N_rank2> + Array() {} + + template<int N_rank2> + P_numtype operator()(const TinyVector<int,N_rank2>& index) const {} +}; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp58.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp58.C new file mode 100755 index 0000000..38c2953 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp58.C @@ -0,0 +1,30 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template<int N, class T> +struct B { +}; + +template<int N1, int N2, int N3> +struct D { + struct E { + template<int N4, class T> + static void f(B<N4,T>) + { } + }; +}; + +template<int N> +struct A { + template<int N2, class T, int N3> + static void f(B<N2,T>, B<N3,T> b) + { + typedef typename D<N2,N3,N>::E E; + E::f(b); + } +}; + +void foo() +{ + A<5>::f(B<5,float>(),B<3,float>()); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp59.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp59.C new file mode 100755 index 0000000..fbdc0d8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp59.C @@ -0,0 +1,22 @@ +// Build don't link: +// GROUPS passed templates membertemplates +template <int N> +struct IndexPlaceholder {}; + +template <int N1, int N2, int N3> +struct ArrayIndexMapping {}; + +template <class T_numtype, int N_rank> +struct Array +{ + template<int N0, int N1> + ArrayIndexMapping<N_rank, N0, N1> + f(IndexPlaceholder<N0>, IndexPlaceholder<N1>); +}; + + +template <class T_numtype> +void foo(T_numtype) +{ + Array<T_numtype, 1> t; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp6.C new file mode 100755 index 0000000..6989a7d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp6.C @@ -0,0 +1,13 @@ +// Build don't link: +// GROUPS passed templates membertemplates +struct S { + template <class T, class U> + S(T, U, T); +}; + + +template <class T, class U> +S::S(T, U, T) +{ +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp60.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp60.C new file mode 100755 index 0000000..7358d72 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp60.C @@ -0,0 +1,10 @@ +// Build don't link: +// GROUPS passed membertemplates +template <class T> +struct S +{ + S(const S<T>& x) {} + + template <class U> + S(const S<U>& x) {} +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp61.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp61.C new file mode 100755 index 0000000..1fdb055 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp61.C @@ -0,0 +1,20 @@ +// Build don't run: +// GROUPS passed membertemplates +struct S +{ + template <class T> + void foo(T t); +}; + + +template <> +void S::foo(int i) +{ +} + + +int main() +{ + S s; + s.foo(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp62.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp62.C new file mode 100755 index 0000000..8cfadef --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp62.C @@ -0,0 +1,20 @@ +// Build don't run: +// GROUPS passed membertemplates +struct S +{ + template <class T> + void foo(T t); +}; + + +template <> +void S::foo<int>(int i) +{ +} + + +int main() +{ + S s; + s.foo(3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp63.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp63.C new file mode 100755 index 0000000..4f793d4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp63.C @@ -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) { } + +int main() +{ + a.f (24); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp64.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp64.C new file mode 100755 index 0000000..6185d3d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp64.C @@ -0,0 +1,21 @@ +// Build don't link: + +template <class T> +struct S1 {}; + +template <class T> +void f(T); + +template <class C> +struct S2 +{ + template <class T> + void f<S1<T> >(T) {} // ERROR - bad specialization. +}; + + +template <class T> +struct S3 +{ + friend class S2<T>; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp65.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp65.C new file mode 100755 index 0000000..ef49d84 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/memtemp66.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp66.C new file mode 100755 index 0000000..d7c1f57 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/memtemp67.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp67.C new file mode 100755 index 0000000..7170c90 --- /dev/null +++ b/gcc_arm/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>(); } +}; + +int 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_arm/testsuite/g++.old-deja/g++.pt/memtemp68.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp68.C new file mode 100755 index 0000000..96a0814 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp68.C @@ -0,0 +1,9 @@ +// Build don't link: + + struct locale + { + template<class _Facet> + locale (const locale&, _Facet*); + locale(int*) throw(); + }; + void f(int* p) { locale keep (p); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp69.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp69.C new file mode 100755 index 0000000..4c9a2a9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp69.C @@ -0,0 +1,35 @@ +struct S +{ + template <class T> + void f(T (&i)[7]) + {} + + void g() + { + int i[] = {1, 2, 3, 4, 5, 6, 7}; + f(i); + int j[7]; + f(j); + } +}; + +struct foo { + template <typename T, int N> + static T* array_end(T(&array)[N]) { return &array[N]; } +}; + +struct X +{ + template <class T1> + void f(const T1&) {} +}; + +int main(int ac, char* av[]) { + S s; + s.g(); + int i[] = {1,2,3,4,5}; + int* e = foo::array_end(i); + X x; + x.f("hello"); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp7.C new file mode 100755 index 0000000..2dee058 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp7.C @@ -0,0 +1,22 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S { + template <class T, class U> + S(T, U, T); +}; + + +template <class T, class U> +S::S(T t1, U u1, T t2) +{ + printf("Hello, world.\n"); +} + + +int main() +{ + S s1(3, "abc", 3); + S s2('a', s1, 'a'); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp70.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp70.C new file mode 100755 index 0000000..2a9fe8a --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/memtemp71.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp71.C new file mode 100755 index 0000000..38cf5c7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp71.C @@ -0,0 +1,6 @@ +// Build don't link: + +class A +{ + template<class T>T epsilon; // ERROR - invalid member template +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp72.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp72.C new file mode 100755 index 0000000..52332c6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp72.C @@ -0,0 +1,17 @@ +// Build don't link: + +template<class P> struct B +{ + template<class T> void f(T& t) { t = T(); } +}; + +enum ptype { t1, t2}; + +struct D : public B<ptype> +{ + void g(double& d) { f(d); } +}; + + +D d; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp73.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp73.C new file mode 100755 index 0000000..5732d49 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp73.C @@ -0,0 +1,18 @@ +template <class T> struct A { + template <class U> void f(U); +}; + +template <int i> struct B { }; + +template <class T> template <class U> +void A<T>::f (U) +{ + enum { foo }; + B<foo> b; +} + +int main () +{ + A<char> a; + a.f (42); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp74.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp74.C new file mode 100755 index 0000000..e99103f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp74.C @@ -0,0 +1,21 @@ +// Build don't link: + +template <class T> +class S +{ +protected: + template <class U> + void f(U); // ERROR - is protected + +private: + template <class U> + void g(U); // ERROR - is private +}; + + +void f() +{ + S<double> s; + s.f(3); // ERROR - within this context + s.g(2.0); // ERROR - within this context +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp75.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp75.C new file mode 100755 index 0000000..4ff38b6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp75.C @@ -0,0 +1,25 @@ +// Build don't link: + +void +print(const int& i) +{ +} + +template<class A> +class bar +{ +public: + template<void (*B)(const A& a)> + void doit(const A& a) + { + B(a); + } +}; + + +int +main() +{ + bar<int> b; + b.template doit<print>(2); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp76.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp76.C new file mode 100755 index 0000000..b202851 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp76.C @@ -0,0 +1,17 @@ +// Build don't link: + +class base +{ +public: + virtual void method()=0; +}; + +class der: public base +{ +public: + template<class C> + void method() + { + C foo; + } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp77.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp77.C new file mode 100755 index 0000000..ca4cf20 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp77.C @@ -0,0 +1,25 @@ +extern "C" int strcmp(const char*, const char*); + +template <class T> +struct S3 +{ + template <class U> + static char* h(U); +}; + +template <> +template <> +char* S3<double>::h(int) { return __PRETTY_FUNCTION__; } + +template <> +template <> +char* S3<char>::h(int) { return __PRETTY_FUNCTION__; } + +int main() +{ + if (strcmp (S3<double>::h(7), + "static char * S3<double>::h<int>(int)") == 0) + return 0; + else + return 1; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp78.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp78.C new file mode 100755 index 0000000..945e7ff --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp78.C @@ -0,0 +1,56 @@ +// Build don't link: + +struct A +{ + void f() {} + + template <class U> + void f() {} +}; + + +template <class T> +struct B +{ + void f() {} + + template <class U> + void f() {} +}; + +template struct B<int>; + +struct C +{ + template <class U> + void f() {} + + template <class U> + void f() {} // ERROR - redeclaration +}; + + +template <class T, class U> +struct D +{ + void f(T); + void f(U); +}; + +template struct D<int, double>; + +template <class T, class U> +struct D2 +{ + void f(T); + void f(U); // ERROR - redeclaration +}; + +template struct D2<int, int>; + +struct E +{ + void f(); + void f(); // ERROR - redeclaration +}; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp79.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp79.C new file mode 100755 index 0000000..4eeffde --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp79.C @@ -0,0 +1,6 @@ +// Build don't link: + +struct foo { + template<typename T> static void bar( foo* ); + template<typename T> void bar() const; // gets bogus error - quals XFAIL *-*-* +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp8.C new file mode 100755 index 0000000..1bf0890 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp8.C @@ -0,0 +1,13 @@ +// Build don't link: +// GROUPS passed templates membertemplates +struct S { + template <class T> + operator T(); +}; + + +template <class T> +S::operator T() +{ +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp80.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp80.C new file mode 100755 index 0000000..61a2fb8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp80.C @@ -0,0 +1,16 @@ +// Build don't link: + +template<typename T> T baz() { return 0; } + +struct foo { + template<typename T> static T staticbar() { return 0; } + template<typename T> T bar() { return 0; } +}; + +void f() +{ + foo t; + int i = baz<int>(); + int j = foo::staticbar<int>(); + int k = t.bar<int>(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp81.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp81.C new file mode 100755 index 0000000..1584f88 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp81.C @@ -0,0 +1,24 @@ +// Build don't link: + +template <int i> class a +{ +public : +int k; + +template <int j> int f() const { return this->f<j-1>(); } + +int g() const { return f<i>(); }; +}; + +template <> +template <> +int a<2>::f<0>() const { + return 0; +} + +int main() +{ +a<2> x; +return x.g(); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp82.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp82.C new file mode 100755 index 0000000..9abd390 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp82.C @@ -0,0 +1,13 @@ +// Build don't link: +// excess errors test - XFAIL *-*-* + +struct foo { + template<typename T> T bar() { return staticbar<T>( this ); } + template<typename T> static T staticbar( foo* ) { return 0; } +}; + +void f() +{ + foo t; + int k = t.bar<int>(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp9.C new file mode 100755 index 0000000..943dbfb --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/memtemp9.C @@ -0,0 +1,22 @@ +// Build don't run: +// GROUPS passed templates membertemplates +extern "C" int printf(const char*, ...); + +struct S { + template <class T> + operator T(); +}; + +template <class T> +S::operator T() +{ + printf("Hello, world.\n"); + return T(); +} + +int main() +{ + S s; + + int i = s.operator int(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/mi1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/mi1.C new file mode 100755 index 0000000..8282261 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/mi1.C @@ -0,0 +1,75 @@ +// Test that binfos aren't erroneously shared between instantiations. + +class PK_CryptoSystem +{ +}; +class PK_Encryptor : public virtual PK_CryptoSystem +{ +}; +class PK_FixedLengthCryptoSystem : public virtual PK_CryptoSystem +{ +public: + virtual unsigned int CipherTextLength() const =0; +}; +class PK_FixedLengthEncryptor : public virtual PK_Encryptor, public virtual PK_FixedLengthCryptoSystem +{ +}; +class PK_SignatureSystem +{ +public: + virtual ~PK_SignatureSystem() {}; +}; +class PK_Signer : public virtual PK_SignatureSystem +{ +public: + virtual void Sign() = 0; +}; +class PK_Verifier : public virtual PK_SignatureSystem +{ +}; +class PK_Precomputation +{ +}; +template <class T> class +PK_WithPrecomputation : public T, public virtual PK_Precomputation +{ +}; +typedef PK_WithPrecomputation<PK_FixedLengthEncryptor> PKWPFLE; +typedef PK_WithPrecomputation<PK_Signer> PKWPS; +template <class EC> class +ECPublicKey : public PKWPFLE +{ +public: + unsigned int CipherTextLength() const { return 1; } + EC ec; +}; +template <class EC> +class ECPrivateKey : public ECPublicKey<EC>, public PKWPS +{ + void Sign() {} + int d; +}; +template <class EC> +class ECKEP : public ECPrivateKey<EC> +{ +}; +class GF2NT : public PK_CryptoSystem +{ + int t1; +}; +class EC2N : public PK_CryptoSystem +{ + GF2NT field; + int a; +}; +template class ECKEP<EC2N>; +template class ECKEP<int>; + +int +main () +{ + ECKEP<EC2N> foo; + + return 0; +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/nested1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/nested1.C new file mode 100755 index 0000000..3df7c47 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/nested1.C @@ -0,0 +1,47 @@ +// Build don't link: + +template <class T1,class T2> +struct X +{ + T1 a; + + struct Y + { + T2 x; + Y (T2 _x) { x=_x; } + }; + +}; + +template <class T1> +struct X<T1,int> +{ + T1 a; + + struct Y + { + int x; + Y (int _x) { x=_x; } + }; + +}; + +template <> +struct X<int,int> +{ + int a; + + struct Y + { + int x; + Y (int _x) { x=_x; } + }; + +}; + +void f () +{ + X<char,char> t1; + X<char,int> t2; + X<int,int> t3; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas01.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas01.C new file mode 100755 index 0000000..6dcf9d3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas01.C @@ -0,0 +1,6 @@ +// Build don't link: + +template <class T> struct A {}; +template <class T> struct B : A<B<T> > {}; + +B<int> x; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas01a.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas01a.C new file mode 100755 index 0000000..027f2ae --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas01a.C @@ -0,0 +1,8 @@ +// Build don't link: + +struct A { + friend struct B : A { // ERROR - + int x; + }; + int y; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas01b.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas01b.C new file mode 100755 index 0000000..fa2e5ac --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas01b.C @@ -0,0 +1,6 @@ +// Build don't link: + +template <class T> struct A { T *t; inline A() { t = 0; } }; +template <class T> struct B : A<B<T> > { int x; inline B() { x = 3; } }; + +B<int> x; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas02.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas02.C new file mode 100755 index 0000000..b4d300d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas02.C @@ -0,0 +1,15 @@ +// Build don't link: + +struct B { int foo (); }; +int B::foo() { return 37; } + +template <class A> struct X { + void f(int); +}; + +template <class A> void X<A>::f (int jj) +{} + +X<int> x; + +void xxx () { x.f (1); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas03.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas03.C new file mode 100755 index 0000000..29b1972 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/niklas03.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <class A> struct X { + A operator[] (int); +}; + +template <class A> A X<A>::operator[] (int i) +{ + return A(); // gets bogus error +} + +X<int> x; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype1.C new file mode 100755 index 0000000..120282a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype1.C @@ -0,0 +1,19 @@ +// Build don't link: + +template<int N_length> +struct B +{ + B(); + ~B(); +}; +template<class P, int N> +struct D +{ + D(int r0); + D(B<N-1> &, int); +}; +template<class T> +void func() +{ + D<T,1> tmp; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype2.C new file mode 100755 index 0000000..e181411 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype2.C @@ -0,0 +1,20 @@ +// Build don't link: + +enum E { }; + +template <const E* ep> +struct S1 +{ +}; + + +struct S2 +{ + static E es[1]; +}; + + +struct S3 +{ + typedef S1<S2::es> S3_Type; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype3.C new file mode 100755 index 0000000..d6f3394 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype3.C @@ -0,0 +1,28 @@ +// Build don't link: + +enum E { e }; + +template <const E* ep> +struct S1 +{ + static char* s; +}; + +template <int D> +struct S2 {}; + +template <> +struct S2<1> +{ + static E es[1]; +}; + +struct S3 +{ + typedef S1<S2<1>::es> S3_Type; +}; + +E S2<1>::es[1] = {e}; + +template <> +char* S1<S2<1>::es>::s = "abc"; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype4.C new file mode 100755 index 0000000..2aa38b1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/nontype4.C @@ -0,0 +1,31 @@ +// Build don't link: + +template <class R, void (R::* A) (void)> +class s +{ +public: + s (R &r) : _r (r) {} + + void e (void) { (_r.*A) (); } + +private: + R &_r; +}; + +class x +{ +public: + void test1 (void) { int j = 0; } + void test2 (void) { int j = 1; } +}; + +int +main (void) +{ + x r; + + s<x, &x::test1> c4 (r); + s<x, &x::test2> c5 (r); + + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload1.C new file mode 100755 index 0000000..25a40b1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload1.C @@ -0,0 +1,15 @@ +template <class T> struct B { }; + +template <class T> struct A { + template <class U, class V> int operator () (U u, V v); + template <class U, class V> void operator () (B<U> u, B<V> v) { } +}; + +int +main () +{ + A<int> a; + B<char> b1; + B<short> b2; + a (b1, b2); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload10.C new file mode 100755 index 0000000..19dd174 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload10.C @@ -0,0 +1,16 @@ +struct B { + int f(int) { return 1; } +}; + +struct D { + template <class T> + int f(T) { return 0; } +}; + +int main() +{ + int (D::*g)(int) = &D::f; + + D d; + return (d.*g)(0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload11.C new file mode 100755 index 0000000..300d91e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload11.C @@ -0,0 +1,27 @@ +// Build don't run: + +template <class T> +int f(int (*fn)(T)) +{ + return (*fn)(3); +} + +struct S { + static int g(int) { return 1; } + static void g(); + + int h(); +}; + +int S::h() +{ + return f(&g); +} + + +int main() +{ + S s; + if (s.h () != 1) + return 1; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload2.C new file mode 100755 index 0000000..809fac4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload2.C @@ -0,0 +1,16 @@ +//Build don't link: +template<class T> +class C +{ +public: + C<T*> O(); + C<T*> O() const; +}; + + +int +main() +{ + C<char*> c; + char* p = Z(c.O); //ERROR - ambiguous c.O +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload3.C new file mode 100755 index 0000000..a716917 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload3.C @@ -0,0 +1,18 @@ +// Build don't link: + +template <class T> +void g(T, T); + +template <class T> +void g(int*, T); + +struct S +{ + void f() const + { + g(X, X+3); + } + + double X[3]; +}; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload4.C new file mode 100755 index 0000000..f4e58e2 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload4.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <class T> void foo(T); + +template <class T> void bar(void (*)(T), T); + +void baz() { + bar<int>(foo, 1); + bar(foo<int>, 1); + bar<int>(foo<int>, 1); + bar(foo, 1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload5.C new file mode 100755 index 0000000..058f4f4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload5.C @@ -0,0 +1,6 @@ +// Build don't link: + +template <class T> void foo(); // ERROR - candidate + +void (*bar)() = foo<void>; +void (*baz)() = foo; // ERROR - can't deduce T diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload6.C new file mode 100755 index 0000000..10f793a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload6.C @@ -0,0 +1,13 @@ +// Check that foo<int> isn't resolved too early. + +template <class T> void foo(T*); +template <class T, class U> void foo(T*, U) { } + +template <class T, class U> void bar(void (*)(T, U), U) { } + +int main() { + bar<int*>(&foo, 1); + bar<int*>(&foo<int>, 1); + bar<int*>(foo, 1); + bar<int*>(foo<int>, 1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload7.C new file mode 100755 index 0000000..bfd8b5a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload7.C @@ -0,0 +1,20 @@ +// Build don't link: + +// Adapted from testcase by Corey Kosak <kosak@cs.cmu.edu> + +template<class T> +struct moo_t { + struct cow_t {}; +}; + +template<class T> void foo(typename moo_t<T>::cow_t) {} + +template<class T> void foo(moo_t<T>) { + typename moo_t<T>::cow_t p; + foo(p); // gets bogus error - no matching function for call - XFAIL *-*-* +} + +int main() { + moo_t<int> x; + foo(x); // gets bogus error - instantiated from here - XFAIL *-*-* +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload8.C new file mode 100755 index 0000000..9f38a5c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload8.C @@ -0,0 +1,12 @@ +// Build don't link: + +// Simplified from bug report by Tim Rowley <tor@cs.brown.edu> + +struct baz; + +void operator*(baz&, double); + +template <class T> inline T operator*(double s, const T &p) + ; // gets bogus error - must have argument of class type - XFAIL *-*-* + +void m(baz& a) { a * .5; } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/overload9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload9.C new file mode 100755 index 0000000..bd9eeb1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/overload9.C @@ -0,0 +1,21 @@ +template <class T> +int f(T) +{ + return 1; +} + + +template <class T> +int f(T*) +{ + return 0; +} + + +int main() +{ + int (*h)(int*) = &f; + int (&k)(int*) = f; + + return (*h)(0) || (*k)(0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/partial1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/partial1.C new file mode 100755 index 0000000..7a92996 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/partial1.C @@ -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_arm/testsuite/g++.old-deja/g++.pt/partial2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/partial2.C new file mode 100755 index 0000000..cdf2199 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/partial2.C @@ -0,0 +1,23 @@ +// Build don't link: +// Tests partial specialization +template<class T> struct foo1 {}; +template<class T, int n> struct foo1<T[n]>; +foo1<char> bar1; +foo1<char[10]> baz1; // ERROR - incomplete type + +template<class T> struct foo2 {}; +template<class T, unsigned n> struct foo2<T[n]>; +foo2<char> bar2; +foo2<char[10]> baz2; // ERROR - incomplete type + +typedef unsigned int other1_t; +template<class T> struct foo3 {}; +template<class T, other1_t n> struct foo3<T[n]>; +foo3<char> bar3; +foo3<char[10]> baz3; // ERROR - incomplete type - + +typedef int other2_t; +template<class T> struct foo4 {}; +template<class T, other1_t n> struct foo4<T[n]>; +foo4<char> bar4; +foo4<char[10]> baz4; // ERROR - incomplete type - diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/pointer1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/pointer1.C new file mode 100755 index 0000000..f854976 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/pointer1.C @@ -0,0 +1,17 @@ +// Build don't link: + +template <class T> +struct S1 +{ +}; + +template <class T> +struct S2 +{ + typedef T* pointer_t; +}; + +int f(S2<S1<int> >::pointer_t p1, S2<S1<int> >::pointer_t p2) +{ + return (int) (p1 - p2); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem1.C new file mode 100755 index 0000000..e14c726 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem1.C @@ -0,0 +1,18 @@ +class foo +{ +public: + template<class T> + T bar() { return 7; } +}; + +int +main() +{ + foo f; + + int (foo::*s)() = &foo::template bar<int>; + if ((f.*s)() == 7) + return 0; + else + return 1; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem2.C new file mode 100755 index 0000000..c6927d1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem2.C @@ -0,0 +1,43 @@ +struct S; + +template <S* (S::*p)()> +struct F { + S* f (S& s) + { + return (s.*p)(); + } +}; + +template <int S::*p> +struct D { + void d (S& s) + { + (s.*p) = 3; + } +}; + +struct S { + S* g (); + int i; + F<&S::g> fg; + D<&S::i> di; + S* h(), k(F<&S::h>); + F<&S::g> fg2; + D<&S::i> di2; +}; + +S* S::g() +{ + return this; +} + +int main() +{ + S s; + s.i = 2; + s.di.d (s); + if (s.i != 3) + return 1; + if (s.fg2.f(s) != &s) + return 1; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem3.C new file mode 100755 index 0000000..8b7c373 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem3.C @@ -0,0 +1,12 @@ +// Build don't link: + +template <class T> +struct S : public S<T*> {}; +template <> +struct S<int**> {}; + +void g() +{ + int S<int*>::*p; + int S<int>::*q = p; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem4.C new file mode 100755 index 0000000..139be92 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem4.C @@ -0,0 +1,28 @@ +// Build don't run: + +template<class T,class T1> +int connect_to_method(T* receiver, + int (T1::*method)()) +{ + return (receiver->*method)(); +} + +class Gtk_Container +{ +public: + int remove_callback() { return 1; } + void remove_callback(int); + int f(); +}; + +int Gtk_Container::f() +{ + return connect_to_method(this, &Gtk_Container::remove_callback); +} + +int main() +{ + Gtk_Container gc; + if (gc.f () != 1) + return 1; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem5.C new file mode 100755 index 0000000..c9e6c9b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ptrmem5.C @@ -0,0 +1,17 @@ +// Build don't link: + +// Based on testcase by adriang@campbellsoft.com + +struct Null { + template <typename T> operator T*() { return 0; } + template <typename C, typename T> operator T C::*() { return 0; } +#if WORK_AROUND + typedef int pmf(); + template <typename C> operator pmf C::* () { return 0; } +#endif +} NULL; + +int *pd = NULL; +int (*pf)() = NULL; +int Null::*pmd = NULL; +int (Null::*pmf)() = NULL; // gets bogus error - cannot convert - XFAIL *-*-* diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/recursion.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/recursion.C new file mode 100755 index 0000000..7efaeb0 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/recursion2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/recursion2.C new file mode 100755 index 0000000..8cb3a2b --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/redecl1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/redecl1.C new file mode 100755 index 0000000..283d83f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/redecl1.C @@ -0,0 +1,22 @@ +// Build don't link: + +template <class T> +struct S1; // ERROR - previous declaration + +template <class T, class U> +struct S1 {}; // ERROR - used 1 template parameter + +template <class T = int> // ERROR - original def of default +struct S2; + +template <class T = int> +struct S2; // ERROR - redefinition of default + +template <class T> // ERROR - template parameter +struct S3; + +template <int I> +struct S3; // ERROR - redeclared here + +template <template <class T> class C> +struct S3; // ERROR - redeclared here diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/redecl2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/redecl2.C new file mode 100755 index 0000000..0b65e1e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/redecl2.C @@ -0,0 +1,14 @@ +// Build don't link: + +struct A +{ + template <class A> + void f(A) {} +}; + +void g() +{ + A a; + a.f(3); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ref1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ref1.C new file mode 100755 index 0000000..8b117a5 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ref1.C @@ -0,0 +1,16 @@ +// Build don't link: + +int i; + +template <void (&FN)()> +void g () +{ + FN (); +} + +void h () +{ + i = 7; +} + +template void g<h>(); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/scope1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/scope1.C new file mode 100755 index 0000000..cfd9cdf --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/scope1.C @@ -0,0 +1,13 @@ +// Build don't link: + +template<class X, class Z> +class foo +{ +public: + typedef X y; + + class bar { + public: + void blah () { y Y; } + }; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/shadow1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/shadow1.C new file mode 100755 index 0000000..dfe99c7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/shadow1.C @@ -0,0 +1,19 @@ +// Build don't link: + +template <class T> +struct S { + typedef T X; + + class C { + typedef T X; + }; +}; + +template <int I> +struct S2 { + enum { A = I }; + + void f() { + int A; + } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/sizeof.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/sizeof.C new file mode 100755 index 0000000..41915b3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/sizeof.C @@ -0,0 +1,17 @@ +extern "C" void abort(); + +template <int I> +int bar() { return I; } + +template <class T> +int foo(T) +{ + return bar<sizeof(T) + 4>() + bar<sizeof(long) + 7>(); +} + + +int main() +{ + if (foo(2) != sizeof(int) + 4 + sizeof(long) + 7) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/sizeof2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/sizeof2.C new file mode 100755 index 0000000..566665a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/sizeof2.C @@ -0,0 +1,20 @@ +// Although template class B is not used at all, it causes the +// incorrect specialization of A to be selected + +// Adapted from testcase by Oskar Enoksson <osken393@student.liu.se> + +extern "C" void abort(); + +template<int N, class T> // Base class +class A { public: static int n() { return sizeof(T); } }; + +template<int N> // Derived #1 +class B: public A<N,char[N]> {}; + +template<int N, int M> // Derived #2 (wrong!) +class C: public A<N,char[M]> {}; + +int main() { + if (C<1,2>::n() != 2) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/sizeof3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/sizeof3.C new file mode 100755 index 0000000..cd5f701 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/sizeof3.C @@ -0,0 +1,25 @@ +// Adapted from testcase by Oskar Enoksson <osken393@student.liu.se> + +extern "C" void abort(); + +template<class T0> +class A { +public: + typedef T0 T; +}; + +template<int K> +class B { + typedef A<char[K]> BC; +}; + +template<int N, int M> +class C { +public: + typedef A<char[M]> AC; +}; + +int main() { + if (sizeof(C<3,7>::AC::T) != 7) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec1.C new file mode 100755 index 0000000..7467293 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec1.C @@ -0,0 +1,21 @@ +// Build don't link: + +template <class S, class T> +class mem_fun1_t { +public: + mem_fun1_t(S (T::*pf)(double)) {} +}; + +template <class T> +class mem_fun1_t<void, T> { +public: + mem_fun1_t(void (T::*pf)(double)) {} +}; + +struct Operation { + double eval(double) {} +}; + +int main() { + mem_fun1_t<double, Operation> m(&Operation::eval); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec10.C new file mode 100755 index 0000000..5d53e2d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec10.C @@ -0,0 +1,27 @@ +extern "C" void abort(); + +template <class T> +struct S +{ + template <int i> + int f(int j) { abort(); return 0; } +}; + +template <> +template <> +int S<double>::f<7>(int j) { return j + 7; } + +template <> +template <> +int S<double>::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_arm/testsuite/g++.old-deja/g++.pt/spec11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec11.C new file mode 100755 index 0000000..340b58e --- /dev/null +++ b/gcc_arm/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 <> +template <> +int S<char>::f(int i) { return 1; } + +int main() +{ + S<char> sc; + + if (sc.f(3) != 1) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec12.C new file mode 100755 index 0000000..d9c3965 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec12.C @@ -0,0 +1,21 @@ +extern "C" void abort(); + +template <class T> +struct S +{ + template <class U> + int f(U u); +}; + + +template <> +template <> +int S<char>::f<int>(int i) { return 1; } + +int main() +{ + S<char> sc; + + if (sc.f(3) != 1) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec13.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec13.C new file mode 100755 index 0000000..e5748f5 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec13.C @@ -0,0 +1,43 @@ +template <class T> +void f(T t); + +template <class T> +void f(T* t); + +template <> +void f(int* ip) {} + +struct S1 +{ + template <class T> + void f(T t); + + template <class T> + void f(T* t); +}; + +template <> +void S1::f(int* ip) {} + +template <class U> +struct S2 +{ + template <class T> + void f(T t); + + template <class T> + void f(T* t); +}; + +template <> +template <> +void S2<double>::f(int* ip) {} + +int main() +{ + int* ip; + S1 s1; + s1.f(ip); + S2<double> s2; + s2.f(ip); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec14.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec14.C new file mode 100755 index 0000000..0380c61 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec14.C @@ -0,0 +1,9 @@ +class X +{ +public: + template <typename A, typename B, typename C> + X() {} + + template <typename A, typename B> + X::X<A, void, B>() {} // ERROR - non-template type used as a template +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec15.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec15.C new file mode 100755 index 0000000..2e97b04 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec15.C @@ -0,0 +1,49 @@ +extern "C" void abort(); + +template <class T> +struct S1 +{ + static void f(); +}; + +template <> +void S1<int>::f() {} + +struct S2 +{ + template <class T> + static void g(T); +}; + +template <> +void S2::g(double) {} + +template <> +void S2::g<int>(int) {} + +template <class T> +struct S3 +{ + template <class U> + static int h(U); +}; + +template <> +template <> +int S3<double>::h(int) { return 0; } + +template <> +template <> +int S3<char>::h(int) { return 1; } + +int main() +{ + S1<int>::f(); + S2::g(3.0); + S2::g(7); + + if (S3<double>::h(7) != 0) + abort(); + if (S3<char>::h(7) != 1) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec16.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec16.C new file mode 100755 index 0000000..9f6da97 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec16.C @@ -0,0 +1,21 @@ +// Build don't link: + +template<class K> +struct A { + int foo(const K&); + int bar(const K&); +}; + +template<class K> +int +A<K>::bar(const K& k) +{ + return(foo(k)); +} + +template<> +int +A<const char*>::foo(const char*const& k) +{ + return((int)k); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec17.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec17.C new file mode 100755 index 0000000..3e3dd63 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec17.C @@ -0,0 +1,44 @@ +// Build don't link: + +template<class T> +struct Foo { }; + +template<class T1, class T2> +struct BT { }; + +template<class T1, class T2> +struct BT< Foo<T1>, Foo<T2> > { static const int i = 1; }; + +template<class T1, class T2> +struct BT< T1, Foo<T2> > { static const int i = 2; }; + +template<class T1, class T2> +struct BT< Foo<T1>, T2 > { static const int i = 3; }; + +template<class T1, class T2> +int foo(Foo<T1>, Foo<T2>) +{ + return 1; +} + +template<class T1, class T2> +int foo(T1, Foo<T2>) +{ + return 2; +} + +template<class T1, class T2> +int foo(Foo<T1>, T2) +{ + return 3; +} + +void f() +{ + BT< double, Foo<int> >::i; + BT< Foo<int>, Foo<int> >::i; + BT< Foo<int>, float >::i; + foo(1.0, Foo<int>()); + foo(Foo<int>(), Foo<int>()); + foo(Foo<int>(), 1.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec18.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec18.C new file mode 100755 index 0000000..d7d034d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec18.C @@ -0,0 +1,30 @@ +// Build don't link: + +template<class A, class B> +void foo(const A& a, const B& b) +{ +} + +template<class A, class B> +void foo(const A& a, const int& b) +{ +} + +template<class A*, class B> +void foo(const A*& a, const B& b) +{ +} + +template<> +void foo(const int&, const double&) +{ +} + + +int +main() +{ + foo("98239", 23); + foo(232, 1.022); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec19.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec19.C new file mode 100755 index 0000000..f9b6011 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec19.C @@ -0,0 +1,5 @@ +// Build don't link: + +template<class T> T f(T o) { return o; } +template<> int f(int o) { return o; } // ERROR - after specialization +template int f(int); // ERROR - explicit instantiation diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec2.C new file mode 100755 index 0000000..338c69e --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/spec20.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec20.C new file mode 100755 index 0000000..c6b699d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec20.C @@ -0,0 +1,16 @@ +// Build don't link: + +// According to the non-normative example in +// [temp.class.spec.mfunc]/2, these should be valid, but the grammar +// in the Standard does not allow partial nor full specializations as +// member-declarations, so we'd better not support them. + +template <class T> +struct S { + template <class U> void f(U); + template <> void f<int>(int); // ERROR - invalid specialization + + template <class V> struct I {}; + template <class V> struct I<V*> {}; + template <> struct I<int>; // ERROR - invalid specialization +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec21.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec21.C new file mode 100755 index 0000000..95e12d2 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec21.C @@ -0,0 +1,16 @@ +// Build don't link: + +template <class T> struct S {}; +template <class T = int> struct S<T*> {}; // ERROR - default argument + +template <int I, int J> struct A {}; +template <int I> struct A<I+5, I*2> {}; // ERROR - argument involves parameter + +template <class T, T t> struct C {}; +template <class T> struct C<T, 1>; // ERROR - type depends on parameter +int i; +template <class T> struct C<T*, &i>; // ERROR - type depends on parameter + +template< int X, int (*array_ptr)[X] > class B {}; +int array[5]; +template< int X > class B<X,&array> { }; // ERROR - type depends on parameter diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec22.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec22.C new file mode 100755 index 0000000..88d55d3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec22.C @@ -0,0 +1,15 @@ +// Build don't link: + +template <class T> +struct S +{ + template <class U> + void f(); +}; + + +template <class T> +template <> // ERROR - enclosing classes not specialized +void S<T>::f<int> () +{ +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec23.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec23.C new file mode 100755 index 0000000..0e9ee61 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec23.C @@ -0,0 +1,10 @@ +/* [temp.expl.spec] p18. */ + +template<class T> +struct A { + template <class U> class B { }; +}; + +template<class T> +class A<T>::B<void> { // ERROR - only one template header +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec24.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec24.C new file mode 100755 index 0000000..2b7d336 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec24.C @@ -0,0 +1,5 @@ +// Build don't link: + +template <class T> class A; +// template <> +class A<int>; // ERROR - missing template header - XFAIL *-*-* diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec25.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec25.C new file mode 100755 index 0000000..884abf0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec25.C @@ -0,0 +1,15 @@ +// Build don't link: + +template <class T, int I> +struct S { +}; + +template <int I> +struct S <double, I> { +}; + +template <class T> +void f () +{ + S<double, T::x> s; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec26.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec26.C new file mode 100755 index 0000000..1bd40b6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec26.C @@ -0,0 +1,11 @@ +// From: lat@iki.fi (Lassi A. Tuura) +// Test that a specialization without an initializer is not a definition, +// as specified in [temp.expl.spec]. + +// Build don't link: + +struct X; +template <class T> struct Y { static const X array[]; }; +template <> const X Y<int>::array []; +struct X { int i; }; +template <> const X Y<int>::array [] = { 0, 1, 2, 3 }; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec27.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec27.C new file mode 100755 index 0000000..63aae4c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec27.C @@ -0,0 +1,18 @@ +// Build don't link: + +template <class T, class U> +struct Y {}; + +template <class T> +struct X {}; + +template <class T, class U> +void f() +{ + typename X<Y<T, U> >::A a; +} + +template <class T, class U> +struct X<Y<T, U> > +{ +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/spec3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec3.C new file mode 100755 index 0000000..b0e710f --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/spec4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec4.C new file mode 100755 index 0000000..b6e6858 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/spec5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec5.C new file mode 100755 index 0000000..553d956 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/spec6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec6.C new file mode 100755 index 0000000..4ef8e65 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec6.C @@ -0,0 +1,31 @@ +// Build don't link: + +struct S1 +{ + template <class T> + void f(T t1, T t2); +}; + + +template <> +void S1::f(int i1, int i2); + +template <class U> +struct S2 +{ + template <class T> + void f(T t1, T t2); +}; + +template <> +template <> +void S2<char>::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_arm/testsuite/g++.old-deja/g++.pt/spec7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec7.C new file mode 100755 index 0000000..81358d9 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/spec8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec8.C new file mode 100755 index 0000000..966f69f --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/spec9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/spec9.C new file mode 100755 index 0000000..e2a2208 --- /dev/null +++ b/gcc_arm/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_arm/testsuite/g++.old-deja/g++.pt/static1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/static1.C new file mode 100755 index 0000000..67e2363 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/static1.C @@ -0,0 +1,21 @@ +extern "C" void abort(); + +template <class T> +class A +{ + public: + static int foo(int); +}; + +template <> +int A<int>::foo(int i) +{ + return i; +} + + +int main() +{ + if (A<int>::foo(22) != 22) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/static2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/static2.C new file mode 100755 index 0000000..5060cfd --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/static2.C @@ -0,0 +1,21 @@ +// Build don't link: + +template <class A> +class TEST +{ +public: + TEST (A) {} +}; + +template <class A> +class TEST2 +{ + static A i; +}; + +template <class A> +A TEST2 <A>::i (0); + +TEST2 <TEST <int> > a; + +template class TEST2 <TEST <int> >; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/static3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/static3.C new file mode 100755 index 0000000..6fe33f9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/static3.C @@ -0,0 +1,16 @@ +// On targets that don't support weak symbols, we require an explicit +// instantiation of arr. +// excess errors test - XFAIL *-*-aout *-*-coff *-*-hpux* + +template<class T> +struct A { + static T arr[5]; +}; + +template <class T> +T A<T>::arr[5] = { 0, 1, 2, 3, 4 }; + +int main () +{ + return A<int>::arr[0]; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/static4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/static4.C new file mode 100755 index 0000000..2ff3221 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/static4.C @@ -0,0 +1,8 @@ +// Build don't link: + +template <class T> +struct S +{ + static const T t = 3; +}; + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/static5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/static5.C new file mode 100755 index 0000000..f6e125d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/static5.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class T> +struct S +{ + static const T t = 3; // ERROR - initializing non-integral type +}; + +double d = S<double>::t; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/static6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/static6.C new file mode 100755 index 0000000..785bc4e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/static6.C @@ -0,0 +1,14 @@ +// Build don't run: + +// Simplified from testcase by Erez Louidor Lior <s3824888@techst02.technion.ac.il> + +// excess errors test - XFAIL *-*-* + +template <class T> struct A { + static const int l[1]; +}; + +template<class T> +const int A<T>::l[1] = {1}; + +int i = A<int>::l[0]; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/static_cast.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/static_cast.C new file mode 100755 index 0000000..26f26c5 --- /dev/null +++ b/gcc_arm/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) ); +} + +int main() +{ + f(0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/stmtexpr.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/stmtexpr.C new file mode 100755 index 0000000..57ef7e3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/stmtexpr.C @@ -0,0 +1,16 @@ +extern "C" void abort(); + +template <class T> +T f(T) +{ + T t = __extension__ ({ T j = 4; j + 3; }); + return t; +} + + +int main() +{ + if (f(3) != 7) + abort(); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/stmtexpr2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/stmtexpr2.C new file mode 100755 index 0000000..475ad72 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/stmtexpr2.C @@ -0,0 +1,24 @@ +extern "C" void abort(); + +int i; + +void g() +{ + i++; +} + +template <class T> +void f(T) +{ + __extension__ ({g();}); +} + +int main() +{ + f(3.0); + if (i != 1) + abort(); + + return 0; +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t00.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t00.C new file mode 100755 index 0000000..14bfcf8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t00.C @@ -0,0 +1,12 @@ +// Build don't link: + +int f1 () { + struct A { A() { a = 2; } int a; } ; + A aa; + return aa.a; +} +int f2 () { + struct A { A() { a = 2; } int a; } ; + A ab; + return ab.a; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t01.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t01.C new file mode 100755 index 0000000..b1d7d38 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t01.C @@ -0,0 +1,6 @@ +// Build don't link: + +template <class A> class B { public: A a; }; +static B<int> b_int; + +int foo () { return b_int.a; } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t03.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t03.C new file mode 100755 index 0000000..29f687a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t03.C @@ -0,0 +1,7 @@ +// Build don't link: + +template <class A> class B { public: A a; }; +static B<int> b_int; +static B<char> b_char; + +int foo () { return b_int.a + b_char.a; } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t04.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t04.C new file mode 100755 index 0000000..faa04fc --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t04.C @@ -0,0 +1,8 @@ +// Build don't link: + +template <class A> class B { public: A a; }; +static B<int> b_int; +static B<char> b_char; +static B<unsigned char> b_uchar; + +int foo () { return b_int.a + b_char.a + b_uchar.a; } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t05.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t05.C new file mode 100755 index 0000000..5c99f77 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t05.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class A> class B { + A a; + public: + B(A&aa); // ERROR - near match + ~B(); +}; // ERROR - candidates +static B<int> b_int (3); // ERROR - no matching function diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t06.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t06.C new file mode 100755 index 0000000..8681f53 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t06.C @@ -0,0 +1,25 @@ +// Build don't link: + +typedef int I; +int i; + +template <class A> class B { + A a; + public: + B(A&aa); + B(); + ~B(); +}; + +template <class B> class C { public: B b; }; + +template <class I, class i> class D : I { public: i ii; }; + +typedef B<int> b_int; +typedef C<int> c_int; +typedef C<b_int> c_b_int2; + +c_b_int2 x2; +int z; +D<c_b_int2,b_int> d; +int q; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t07.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t07.C new file mode 100755 index 0000000..3cdb3da --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t07.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class A> class B { + A a; + public: + const A& value () { return a; } +}; +static B<int> b_int; + +int foo () { return b_int.value(); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t08.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t08.C new file mode 100755 index 0000000..ce24cca --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t08.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class A> class B { + A a; + public: + B (); + ~B (); +}; +B<int> b_int; +B<int> *bp = &b_int; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t09.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t09.C new file mode 100755 index 0000000..dab4730 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t09.C @@ -0,0 +1,6 @@ +// Build don't link: + +struct bs_1 { + typedef int (*pfi) (void); +}; +static bs_1::pfi fp; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t10.C new file mode 100755 index 0000000..4f3fc18 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t10.C @@ -0,0 +1,6 @@ +// Build don't link: + +template <class A> class B { public: A a; B(); }; +class B<char> { public: int y[10]; }; +static B<int> bi; +static B<char> bc; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t11.C new file mode 100755 index 0000000..8137349 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t11.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class A> +class B { +public: + A a; + B() { x = 2; } // ERROR - no x +}; +static B<int> bi; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t11a.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t11a.C new file mode 100755 index 0000000..0dcd297 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t11a.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <class A> +class B { +public: + A a; + B() { a = 2; } +}; +static B<int> bi; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t12.C new file mode 100755 index 0000000..0ebb045 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t12.C @@ -0,0 +1,25 @@ +// Build don't link: + +class OBJECT {int a;}; +class STDFILE {int b;}; + +template <class T> class VECTOR { + T *v; + int sz; +public: + T& elem(int i) { return v[i]; } + T& operator[] (int i); +}; + +template <class T> +class PVECTOR : VECTOR<void *> { +public: + T*& elem(int i) + {return (T*&) VECTOR<void *>::elem(i); } + T*& operator[] (int i) + {return (T*&) VECTOR<void *>::operator[](i);} +}; + +PVECTOR<OBJECT *> *foo; + +PVECTOR<STDFILE *> *goo; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t12a.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t12a.C new file mode 100755 index 0000000..e0f1e65 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t12a.C @@ -0,0 +1,5 @@ +// Build don't link: + +int a (void * x) { return 1; } +typedef void *T; +int b (T x) { return 2; } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t13.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t13.C new file mode 100755 index 0000000..2f589a7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t13.C @@ -0,0 +1,19 @@ +// Build don't link: + +template <class A> class B { +public: + B(); + A a; + int i; +}; + +void *f () { + return new B<char *>; +} + +struct foo { int i[10]; }; +extern B<foo> *foop; + +void f2 () { + foop = new B<foo>; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t14.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t14.C new file mode 100755 index 0000000..8532f2b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t14.C @@ -0,0 +1,24 @@ +// Build don't link: + +class OBJECT +{ + int a; +}; + + + +template <class T> class TESTA +{ +public: + TESTA(); + T foo(int i) {T t = 0; return t}; // ERROR - no semi +}; + + + +void foo() +{ + TESTA<OBJECT *> *foo; + + foo = new TESTA<OBJECT *>; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t14a.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t14a.C new file mode 100755 index 0000000..694f846 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t14a.C @@ -0,0 +1,25 @@ +// Build don't link: + +class OBJECT +{ + int a; +}; + + + +template <class T> class TESTA +{ +public: + TESTA(); + T foo(int i) {T t = 0; return t;} +}; + + + +void foo() +{ + TESTA<OBJECT *> *foo; + + foo = new TESTA<OBJECT *>; +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t16.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t16.C new file mode 100755 index 0000000..4cdf3a2 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t16.C @@ -0,0 +1,30 @@ +extern "C" void printf (char *, ...); +template <class T> T max (const T&x, const T&y) +{ + return (x>y)?x:y; +} +int min (const float&, const float&); +int min (const int& i1, const int& i2) { + return (i1 < i2) ? i1 : i2; +} + +class complex +{ + double re, im; + public: + complex (double r, double i=0) { re = r; im = i; } + friend int operator > (const complex& x, const complex &y) { return 0; } + void print () { } +}; + +int main () +{ + complex c1 (1, 0); + complex c2 (2, 0); + + int j = max (1, 37); + complex m1 = max (c1, c2); + m1.print (); + printf ("j=%d\n", j); + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t18.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t18.C new file mode 100755 index 0000000..760747e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t18.C @@ -0,0 +1,19 @@ +// Build don't link: + +extern void byebye (); +template <class T1, class T2> +struct A +{ + T1 t1; + T2 t2; + A() { t1 = 0; t2 = 0; } + ~A() { byebye(); } +}; + +template <class Q> +int f (A<int, Q> a) { + return a.t1; +} + +extern A<int,double*> aa; +int foop () { return f(aa); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t20.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t20.C new file mode 100755 index 0000000..07a86fa --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t20.C @@ -0,0 +1,15 @@ +// Build don't link: + +template <class X> class A { +public: + X aaa; + int foo(); +}; + +template <class X> A<X> f(X); + +void frep() { + int x; + x = f(6.4).foo(); +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t21.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t21.C new file mode 100755 index 0000000..f05f89f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t21.C @@ -0,0 +1,8 @@ +// Build don't link: + +template <class X> class A { public: int a; X x; }; +template <class X> X f (A<X> a) { return a.x; } + +extern A<double> a_dbl; + +double fred () { return f (a_dbl); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t22.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t22.C new file mode 100755 index 0000000..1102baa --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t22.C @@ -0,0 +1,10 @@ +// Build don't link: + +class AA { public: static int xx; }; +template <class X> class A { + public: + static int x; +}; + +int AA::xx; +template <class Y> int A<Y>::x; // gets bogus error diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t23.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t23.C new file mode 100755 index 0000000..82221b3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t23.C @@ -0,0 +1,18 @@ +// Build don't link: + +template <class T> class temp1 +{ +public: + T tvar; +}; + + +template <class T2> class temp2 +{ +public : + temp1<T2> t1var; +}; + + +temp1<int> temp1var; +temp2<int> temp2var; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t24.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t24.C new file mode 100755 index 0000000..6032270 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t24.C @@ -0,0 +1,8 @@ +// Build don't link: +// Special g++ Options: + +template <class X> int f (X x, X y) { return 23; } + +int foo () { + return f (7); // ERROR - +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t25.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t25.C new file mode 100755 index 0000000..2319774 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t25.C @@ -0,0 +1,8 @@ +// Build don't link: + +template <class X> int f (X x, X y) { return 23; } +template <class X> int f (X x, int j = 3) { return 29; } + +int foo () { + return f (7); // gets bogus error - +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t26.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t26.C new file mode 100755 index 0000000..cfc1591 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t26.C @@ -0,0 +1,8 @@ +// Build don't link: + +template <class X> int f (X x, unsigned int j = 3) { return 29; } +template <class X> int f (X x, X y) { return 23; } + +int foo () { + return f (7.0, 9.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t27.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t27.C new file mode 100755 index 0000000..f3246e8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t27.C @@ -0,0 +1,8 @@ +// Build don't link: + +template <class X> int f (X x, int * j) { return 29; } +template <class X> int f (X x, ...) { return 23; } + +int foo () { + return f (7.0, 9.0); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t28.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t28.C new file mode 100755 index 0000000..dd524cb --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t28.C @@ -0,0 +1,10 @@ +// Build don't link: + +template <class X> class B; +template <class X> int f (B<X> b) { return 37; } +template <class Y> class B { public: Y y; B() { y = 1; } }; + +int foo () { + B<double> bd; + return f(bd); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t29.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t29.C new file mode 100755 index 0000000..54a5052 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t29.C @@ -0,0 +1,8 @@ +// Build don't link: + +template <class X, int n> X f (auto X (*x)[n]) { return (*x)[n/2]; } +extern int i[30]; +extern double d[99]; + +int foo (int ii) { return f (&i); } // causes abort +double foo (double dd) { return f (&d); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t30.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t30.C new file mode 100755 index 0000000..42d88ea --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t30.C @@ -0,0 +1,8 @@ +// Build don't link: + +template <class X, int n> X f (auto X (*x)[n]) { return (*x)[n/2]; } +extern int i[30], i2[33]; +extern double d[99]; + +int foo (int ii) { return f (&i) + f(&i2); } // causes abort +double foo (double dd) { return f (&d); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t31.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t31.C new file mode 100755 index 0000000..8800ebe --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t31.C @@ -0,0 +1,17 @@ +// Build don't link: + +struct B { int foo (); }; +int B::foo() { return 37; } + +template <class A> struct X { + void f(); +}; + +template <class A> void X<A>::f () +{} + +X<int> x; + +void xyzzy () { + x.f (); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t32.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t32.C new file mode 100755 index 0000000..89f8db1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t32.C @@ -0,0 +1,14 @@ +// Build don't link: + +template <class X> struct A { + int fooo (int x); + int x; + inline int y () { return 3; } + inline int z () { return 5; } +}; + +template <class Y> int A<Y>::fooo (int t) { return (this->*(x?&A<Y>::y : &A<Y>::z))() + t; }; // gets bogus error + +A<int> ai; + +int frop () { return ai.fooo (100); } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t32a.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t32a.C new file mode 100755 index 0000000..13dfda1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t32a.C @@ -0,0 +1,10 @@ +// Build don't link: + +struct A { + int x; + int y (); + int z (); + int foo (int j); +}; + +int A::foo (int q) { return q + (this->*(x ? &A::y : &A::z)) (); } // gets bogus error diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t34.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t34.C new file mode 100755 index 0000000..acf858a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t34.C @@ -0,0 +1,8 @@ +// Build don't link: + +template <class X> struct A { int operator [] (int); }; +template <class Y> int A<Y>::operator[] (int j) { return j * j; } + +extern A<void **> avpp; + +int q () { return avpp[99]; } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t34a.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t34a.C new file mode 100755 index 0000000..7d5aebf --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t34a.C @@ -0,0 +1,16 @@ +// Build don't link: + +struct A { + int operator[] (int); +}; + +//int A::operator[] (int); + +int A::operator[] (int j) +{ + return j * j; +} + +extern A a; + +int q () { return a[99]; } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t35.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t35.C new file mode 100755 index 0000000..f0ed971 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t35.C @@ -0,0 +1,12 @@ +// Build don't link: +// Special g++ Options: +template<class X> struct A { + A (); + ~A(); + int x, y, z; +}; + +template <class Y> inline A<Y>::A () { x = y = 3; z = 99; } +template <class Z> inline A<Z>::~A() { y = 9999; } + +A<int> ai; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t36.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t36.C new file mode 100755 index 0000000..bb791b9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t36.C @@ -0,0 +1,6 @@ +// Build don't link: + +void * foo () { + typedef int * ip; + return new ip; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t37.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t37.C new file mode 100755 index 0000000..434dadd --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t37.C @@ -0,0 +1,17 @@ +// Build don't link: + +class A { +public: + A(int); // ERROR - referenced below + A(float); // ERROR - referenced below + ~A(); +}; // ERROR - synthesized copy ctor + +A::A() { // ERROR - +} + +A::A(int) { +} + +A::~A() { +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t37a.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t37a.C new file mode 100755 index 0000000..797b78d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t37a.C @@ -0,0 +1,18 @@ +// Build don't link: + +class A { +public: + A(int); + A(float); + ~A(); +}; + +A::A(float f) { +} + +A::A(int i) { +} + +A::~A() { +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t38.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t38.C new file mode 100755 index 0000000..cd89282 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t38.C @@ -0,0 +1,19 @@ +// Build don't link: +// Special g++ Options: +extern "C" int printf (const char *, ...); + +template<class X> struct A { + A (int, char); + ~A (); + A (X *, float); +}; + +template<class Y> inline A<Y>::A (int i, char c) { + printf ("%d, %d\n", i, c); +} +template<class Z> A<Z>::~A() {} +template<class W> A<W>::A (W * d, float f) { + printf ("%x, %e\n", d, f); +} + +A<void> avoid (9, 0); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t39.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t39.C new file mode 100755 index 0000000..d12ef81 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t39.C @@ -0,0 +1,25 @@ +extern "C" int printf (const char *, ...); + +template <class T> +struct frob { + T *ptr; + void print (); + frob (T* init) { ptr = init; } +}; + +template <class T> +void frob<T>::print () { + printf ("this = %08x\n", this); + printf (" ptr = %08x\n", ptr); + printf (" values = %x %x %x ...\n", ptr[0], ptr[1], ptr[2]); +} + + static int x[10]; + frob<char> fc ("hello"); + frob<int> fi (x); + +int main () { + fc.print (); + fi.print (); + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t40.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t40.C new file mode 100755 index 0000000..34768a9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t40.C @@ -0,0 +1,11 @@ +// Build don't link: + +struct A { + struct B { + B (int); + }; + static int foop (B); + static int splat () { + return foop (B (1)); + } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t41.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t41.C new file mode 100755 index 0000000..c02f677 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t41.C @@ -0,0 +1,11 @@ +// Build don't link: + +struct A { + struct B { + B (int); + }; + static int foop (B); + int splat () { + return foop (B (1)); + } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/t42.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/t42.C new file mode 100755 index 0000000..5545994 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/t42.C @@ -0,0 +1,17 @@ +extern "C" void abort (); + +struct A { + struct stat { + int x; + stat (int j) { abort (); } + }; + static int stat (double d) { return 0; } // gets bogus error - cfront takes it + static int zap () { + stat (0); + return stat (1); // gets bogus error - this should work + } +}; + +int main () { + return A::zap (); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/test5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/test5.C new file mode 100755 index 0000000..dc74c2d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/test5.C @@ -0,0 +1,3 @@ +// Build don't link: + +template <char *a, const char *b, char *const c> class A{int x;}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/tiemann1r.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/tiemann1r.C new file mode 100755 index 0000000..65e6807 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/tiemann1r.C @@ -0,0 +1,8 @@ +// Build don't link: + +struct bs_1 +{ + typedef int (*p_user_hashf)(int); +}; + +bs_1::p_user_hashf i_user_hashf; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/tiemann2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/tiemann2.C new file mode 100755 index 0000000..4c71541 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/tiemann2.C @@ -0,0 +1,34 @@ +extern "C" void printf (char *, ...); +template <class T> T max (const T&x, const T&y) +{ + return (x>y)?x:y; +} + +class complex +{ + double re, im; + public: + complex (double r, double i=0) { re = r; im = i; } + friend int operator > (const complex& x, const complex &y); + void print () { printf ("re = %g; im = %g;\n", re, im); } +}; +int operator >(const complex& x, const complex &y) +{ + double c1 = x.re * x.re + x.im * x.im; + double c2 = y.re * y.re + y.im * y.im; + return c1 > c2; +} + +int main () +{ + complex c1 (1, 0); + complex c2 (2, 0); + complex c3 (2, 3); + complex c4 (2, 1); + + complex m1 = max (c1, c2); + complex m2 = max (c3, c4); + m1.print (); + m2.print (); + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/to2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/to2.C new file mode 100755 index 0000000..936729c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/to2.C @@ -0,0 +1,7 @@ +// Build don't link: + +template <class A> class B { public: A a; }; +static B<int> b_int; +static B<int> b_int2; + +int foo () { return b_int.a + b_int2.a; } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/tt.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/tt.C new file mode 100755 index 0000000..e597875 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/tt.C @@ -0,0 +1,33 @@ +// Build don't link: + +#define DEF_A struct A { A() { a = 2; } int a; } + +#if 1 +int f1 () { + DEF_A; + A aa; + return aa.a; +} + +int f2 () { + DEF_A; + A ab; + return ab.a; +} +/* results: +tt.cc: In function int f2 (): +tt.cc:9: conflicting types for `A::A ()' +tt.cc:3: previous declaration of `A::A ()' +/u2/projects/gcc2/src/cplus-cvt.c:1149: failed assertion `distance >= 0' +gcc2: Program cc1plus got fatal signal 6. +*/ +#else + +struct B1 { DEF_A; A aa; }; + +struct B2 { DEF_A; A aa; }; +/* results: +/u2/projects/gcc2/src/cplus-decl.c:5469: failed assertion `return_type == return_ctor' +gcc2: Program cc1plus got fatal signal 6. +*/ +#endif diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/tt2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/tt2.C new file mode 100755 index 0000000..f6c435b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/tt2.C @@ -0,0 +1,27 @@ +// Build don't link: + +int f1 () { + struct A { + A() : b (2) { } + int fred () { return b.hi_mom; } + struct B { + int hi_mom; + B (int a) { hi_mom = a; } + }; + B b; + }; + A aa; + return aa.fred(); +} + +int f2 () { + struct A { + ~A() { a = 3; } + int a; + int fred () { return a + 1; } + }; + + A ab; + ab.a = 12; + return ab.fred(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp1.C new file mode 100755 index 0000000..4c6bac0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp1.C @@ -0,0 +1,14 @@ +// Build don't link: + +template<class E> class D +{ +}; + +template<template<class> class D,class E> class C +{ +}; + +int main() +{ + C<int,D> c; // ERROR - args not match +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp10.C new file mode 100755 index 0000000..ca0c9b6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp10.C @@ -0,0 +1,30 @@ +// Build don't link: + +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D d; // ERROR - D is a template + public: + int f(); +}; + +template<template<class> class D,class E> int C<D,E>::f() +{ + return d.f(); // ERROR - d not properly declared +} + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp11.C new file mode 100755 index 0000000..213eb40 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp11.C @@ -0,0 +1,25 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { return d.f(); } +}; + +int main() +{ + C<D,int> c; + C<D,char> d; + c.f(); + d.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp12.C new file mode 100755 index 0000000..c9bc9f3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp12.C @@ -0,0 +1,28 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class E,class D> class C +{ + E<D> d; + public: + int f(); +}; + +template<template<class> class E,class D> int C<E,D>::f() +{ + return d.f(); +} + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp13.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp13.C new file mode 100755 index 0000000..2745c7a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp13.C @@ -0,0 +1,28 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f(); +}; + +template<template<class> class D,class E> int C<D,E>::f() +{ + return d.f(); +} + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp14.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp14.C new file mode 100755 index 0000000..04877d6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp14.C @@ -0,0 +1,30 @@ +template<class T> class D +{ + T a; + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<class E,template<class> class DD = D> class C +{ + DD<E> d; + public: + int f(); +}; + +template<class E,template<class> class DD> int C<E,DD>::f() +{ + DD<E> d2; + return d2.f(); +} + +int main() +{ + C<int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp15.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp15.C new file mode 100755 index 0000000..25f3c4d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp15.C @@ -0,0 +1,29 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f(); +}; + +template<template<class> class D,class E> int C<D,E>::f() +{ + D<E> d2; + return d2.f(); +} + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp16.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp16.C new file mode 100755 index 0000000..ac736fa --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp16.C @@ -0,0 +1,30 @@ +template<class T> class D +{ + T a; + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f(); +}; + +template<template<class> class D,class E> int C<D,E>::f() +{ + D<E> d2; + return d2.f(); +} + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp17.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp17.C new file mode 100755 index 0000000..6852404 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp17.C @@ -0,0 +1,30 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f(); + int g() { return 0; } +}; + +template<template<class> class D,class E> int C<D,E>::f() +{ + C<D,E> d2; + return d2.g(); +} + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp18.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp18.C new file mode 100755 index 0000000..6c9e579 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp18.C @@ -0,0 +1,30 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f(); + int g() { return 0; } +}; + +template<template<class> class D,class E> int C<D,E>::f() +{ + C<D,char> d2; + return d2.g(); +} + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp19.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp19.C new file mode 100755 index 0000000..8a24946 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp19.C @@ -0,0 +1,24 @@ +#include <vector> + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int size() { return d.size(); } +}; + +template<template<class> class D,class E> int size(D<E> &d1) +{ + d1.size(); + C<D,E> d2; + d2.size(); + return 0; +} + +int main() +{ + std::vector<int> c1; + std::vector<char> c2; + size(c1); + size(c2); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp2.C new file mode 100755 index 0000000..5badbe2 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp2.C @@ -0,0 +1,14 @@ +// Build don't link: + +template<class E> class D +{ +}; + +template<template<class> class D,int> class C +{ +}; + +int main() +{ + C<1,D> c; // ERROR - args not match +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp20.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp20.C new file mode 100755 index 0000000..e3b26c6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp20.C @@ -0,0 +1,27 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C : D<E> +{ + public: + int g(); +}; + +template<template<class> class D,class E> int C<D,E>::g() +{ + return f(); +} + +int main() +{ + C<D,int> c; + c.g(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp21.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp21.C new file mode 100755 index 0000000..c6cc24b --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp21.C @@ -0,0 +1,33 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C : D<E> +{ + public: + int g(); +}; + +template<template<class> class D,class E> int C<D,E>::g() +{ + return f(); +} + +class E : C<D,int> +{ + public: + int h() { return g(); } +}; + +int main() +{ + E c; + c.h(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp22.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp22.C new file mode 100755 index 0000000..7eac0ed --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp22.C @@ -0,0 +1,33 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class DD,class EE> class C : DD<EE> +{ + public: + int f(); +}; + +template<template<class> class DD,class EE> int C<DD,EE>::f() +{ + return DD<EE>::f(); +} + +class E : C<D,int> +{ + public: + int f() { return C<D,int>::f(); } +}; + +int main() +{ + E c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp23.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp23.C new file mode 100755 index 0000000..636bb1c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp23.C @@ -0,0 +1,33 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class E,class D> class C : E<D> +{ + public: + int f(); +}; + +template<template<class> class E,class D> int C<E,D>::f() +{ + return E<D>::f(); +} + +class E : C<D,int> +{ + public: + int f() { return C<D,int>::f(); } +}; + +int main() +{ + E c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp24.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp24.C new file mode 100755 index 0000000..1e6278f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp24.C @@ -0,0 +1,22 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> int f() +{ + D<E> d; + return d.f(); +}; + +int main() +{ + f<D,int>(); + f<D,char>(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp25.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp25.C new file mode 100755 index 0000000..c30905e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp25.C @@ -0,0 +1,33 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { return d.f(); } +}; + +template<template<class> class D,class E> int f(D<E> &d1) +{ + d1.f(); + C<D,E> d2; + d2.f(); + return 0; +} + +int main() +{ + D<int> c1; + D<char> c2; + f(c1); + f(c2); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp26.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp26.C new file mode 100755 index 0000000..6e6425e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp26.C @@ -0,0 +1,33 @@ +template<class T, class U = int> class D +{ + public: + int f(); +}; + +template<class T, class U> int D<T,U>::f() +{ + return sizeof(T)+sizeof(U); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { return d.f(); } +}; + +template<template<class> class D,class E> int f(D<E> &d1) +{ + d1.f(); + C<D,E> d2; + d2.f(); + return 0; +} + +int main() +{ + D<int> c1; + D<char> c2; + f(c1); + f(c2); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp27.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp27.C new file mode 100755 index 0000000..7ecf301 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp27.C @@ -0,0 +1,35 @@ +template<class T> class D +{ + public: + int f() const; +}; + +template<class T> int D<T>::f() const +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() const { return d.f(); } +}; + +template<template<class> class D,class E> int f(const D<E> &d1) +{ + d1.f(); + C<D,E> d2; + d2.f(); + return 0; +} + +int main() +{ + D<const int> c1; + D<char> c2; + const D<char> c3(c2); + f(c1); + f(c2); + f(c3); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp28.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp28.C new file mode 100755 index 0000000..5948dc5 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp28.C @@ -0,0 +1,39 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { return d.f(); } +}; + +template<template<class> class D,class E> int f(D<E> &d1) +{ + d1.f(); + C<D,E> d2; + d2.f(); + return 0; +} + +template<> int f<>(D<char> &d1) +{ + d1.f(); + return 0; +} + +int main() +{ + D<int> c1; + D<char> c2; + f(c1); + f(c2); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp29.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp29.C new file mode 100755 index 0000000..b431ad0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp29.C @@ -0,0 +1,32 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +extern "C" void abort(); + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { abort(); return 0; } +}; + +template<class E> class C<D,E> +{ + D<E> d; + public: + int f() { return d.f(); } +}; + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp3.C new file mode 100755 index 0000000..322dd19 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp3.C @@ -0,0 +1,14 @@ +// Build don't link: + +template<class E,class F> class D +{ +}; + +template<template<class> class D,class E> class C +{ +}; + +int main() +{ + C<D,int> c; // ERROR - param list not match// WARNING - sees it as not having a type +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp30.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp30.C new file mode 100755 index 0000000..c47b157 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp30.C @@ -0,0 +1,37 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +extern "C" void abort(); + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { abort(); return 0; } +}; + +template<class E> class C<D,E> +{ + D<E> d; + public: + int f(); +}; + +template<class E> int C<D,E>::f() +{ + return d.f(); +} + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp31.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp31.C new file mode 100755 index 0000000..4e1acf2 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp31.C @@ -0,0 +1,32 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +extern "C" void abort(); + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { abort(); return 0; } +}; + +template<template <class> class F> class C<F,int> +{ + F<int> d; + public: + int f() { return d.f(); } +}; + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp32.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp32.C new file mode 100755 index 0000000..5c7a63a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp32.C @@ -0,0 +1,37 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +extern "C" void abort(); + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { abort(); return 0; } +}; + +template<template <class> class F> class C<F,int> +{ + F<int> d; + public: + int f(); +}; + +template<template<class>class F> int C<F,int>::f() +{ + return d.f(); +} + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp33.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp33.C new file mode 100755 index 0000000..3755ff3 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp33.C @@ -0,0 +1,31 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + template<template<class> class F> int f(F<int>); +}; + +template<template<class> class D,class E> +template<template<class> class F> int C<D,E>::f(F<int>) +{ + F<E> d2; + return d2.f(); +} + +int main() +{ + C<D,int> c; + D<int> d; + c.f(d); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp34.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp34.C new file mode 100755 index 0000000..d605043 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp34.C @@ -0,0 +1,31 @@ +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + return sizeof(T); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f(); +}; + +template<template<class> class D,class E> int C<D,E>::f() +{ + D<E> d2; + return d2.f(); +} + +template class C<D,int>; + +int main() +{ + C<D,int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp35.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp35.C new file mode 100755 index 0000000..655f406 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp35.C @@ -0,0 +1,35 @@ +template<int T, class U = int> class D +{ + public: + int f(); +}; + +template<int T, class U> int D<T,U>::f() +{ + return T+sizeof(U); +} + +template<template<int> class D,class E> class C +{ + D<1> d; + public: + int f() { return d.f(); } +}; + +template<template<int> class D> int f(D<2> &d1) +{ + d1.f(); + return 0; +} + +template<template<int> class D> int f(D<1> &d1) +{ + d1.f(); + return 0; +} + +int main() +{ + D<1> c1; + f(c1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp36.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp36.C new file mode 100755 index 0000000..976bc0e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp36.C @@ -0,0 +1,29 @@ +template<int T, class U = int> class D +{ + public: + int f(); +}; + +template<int T, class U> int D<T,U>::f() +{ + return T+sizeof(U); +} + +template<template<int> class D,class E> class C +{ + D<1> d; + public: + int f() { return d.f(); } +}; + +template<template<int> class D> int f(D<1> &d1) +{ + d1.f(); + return 0; +} + +int main() +{ + D<1> c1; + f(c1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp37.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp37.C new file mode 100755 index 0000000..01b0d29 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp37.C @@ -0,0 +1,29 @@ +template<int T, class U = int> class D +{ + public: + int f(); +}; + +template<int T, class U> int D<T,U>::f() +{ + return T+sizeof(U); +} + +template<template<int> class D,class E> class C +{ + D<1> d; + public: + int f() { return d.f(); } +}; + +template<template<int> class D, int T> int f(D<T> &d1) +{ + d1.f(); + return T; +} + +int main() +{ + D<1> c1; + f(c1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp38.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp38.C new file mode 100755 index 0000000..00c663c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp38.C @@ -0,0 +1,29 @@ +template<class T, class U = int> class D +{ + public: + int f(); +}; + +template<class T, class U> int D<T,U>::f() +{ + return sizeof(T)+sizeof(U); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { return d.f(); } +}; + +template<template<class> class D> int f(D<int> &d1) +{ + d1.f(); + return 0; +} + +int main() +{ + D<int> c1; + f(c1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp39.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp39.C new file mode 100755 index 0000000..24ff6c0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp39.C @@ -0,0 +1,29 @@ +template<class T, class U = T> class D +{ + public: + int f(); +}; + +template<class T, class U> int D<T,U>::f() +{ + return sizeof(T)+sizeof(U); +} + +template<template<class> class D,class E> class C +{ + D<E> d; + public: + int f() { return d.f(); } +}; + +template<template<class> class D> int f(D<int> &d1) +{ + d1.f(); + return 0; +} + +int main() +{ + D<int> c1; + f(c1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp4.C new file mode 100755 index 0000000..249ad9c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp4.C @@ -0,0 +1,15 @@ +// Build don't link: + +template<class E> class D +{ +}; + +template<template<class> class D,class E> class C +{ + D<1> d; // ERROR - arg not match +}; + +int main() +{ + C<D,int> c; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp40.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp40.C new file mode 100755 index 0000000..d30b4d6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp40.C @@ -0,0 +1,20 @@ +#include <vector> + +template<class E,template<class> class DD = std::vector> class C +{ + DD<E> d; + public: + int f(); +}; + +template<class E,template<class> class DD> int C<E,DD>::f() +{ + DD<E> d2; + return d2.size(); +} + +int main() +{ + C<int> c; + c.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp41.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp41.C new file mode 100755 index 0000000..f206c03 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp41.C @@ -0,0 +1,23 @@ +template<template<class> class D,class E> class C +{ + public: + int g() { return 1; } +}; + +template<class T> class D +{ + public: + int f(); +}; + +template<class T> int D<T>::f() +{ + C<D,D> c; + return c.g(); +} + +int main() +{ + D<char> d; + d.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp42.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp42.C new file mode 100755 index 0000000..b2610df --- /dev/null +++ b/gcc_arm/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; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp43.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp43.C new file mode 100755 index 0000000..a020655 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp43.C @@ -0,0 +1,30 @@ +// Build don't link: + +template < class T, template <class> class E1, template <class> class E2 > +struct Add { + Add(const E1<T>& e1, const E2<T>& e2) {} +}; + + +template < class T, template <class> class E1, template <class> class E2 > +struct Mul { + Mul(const E1<T>& e1, const E2<T>& e2) {} +}; + + +template < class T > +struct Lit { + Lit(const T& t) {} +}; + + +template < class T > +struct Id { + Add < T, Id, Lit > operator+(const T& t) const { + return Add < T, Id, Lit >(*this, Lit<T>(t)); + } + + Mul < T, Id, Lit > operator*(const T& t) const { + return Mul < T, Id, Lit >(*this, Lit<T>(t)); + } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp44.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp44.C new file mode 100755 index 0000000..7f797e6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp44.C @@ -0,0 +1,17 @@ +// Build don't link: + +template < class T, template < class > class E1, template < class > class E2 > +class Add { +public: + Add(const E1<T>& e1, const E2<T>& e2) {} +}; + +template < class T > +struct Id { + template < template < class > class E > + Add < T, Id, E > operator+(const E<T>& e) const { + return Add < T, Id, E >(*this, e); + } +}; + +template struct Id<double>; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp45.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp45.C new file mode 100755 index 0000000..05fcd9d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp45.C @@ -0,0 +1,7 @@ +// Build don't link: + +template<class M, class T> struct temp2; +template<template<class> class M, class T> struct temp2<M<T>, T> {}; + +template<class M> struct temp1; +template<template<class> class M, class T> struct temp1<M<T> > {}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp46.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp46.C new file mode 100755 index 0000000..23a32a8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp46.C @@ -0,0 +1,4 @@ +// Build don't link: + +template <template<class> class TT> void f() {} +template <template<class,class> class TT> void f() {} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp47.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp47.C new file mode 100755 index 0000000..731ce40 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp47.C @@ -0,0 +1,16 @@ +template <template<class,class> class TT, class T> void f(T) +{ +} + +template <template<class> class TT, class T> void f(T) +{ +} + +template <class T> class C {}; +template <class T,class U> class D {}; + +int main() +{ + f<C>(1); + f<D>(1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp48.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp48.C new file mode 100755 index 0000000..33d0d47 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp48.C @@ -0,0 +1,16 @@ +template <template<int> class TT, class T> void f(T) +{ +} + +template <template<class> class TT, class T> void f(T) +{ +} + +template <class T> class C {}; +template <int> class D {}; + +int main() +{ + f<C>(1); + f<D>(1); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp49.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp49.C new file mode 100755 index 0000000..b0a02d2 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp49.C @@ -0,0 +1,9 @@ +// Build don't link: + +template <int i> class C {}; +template <template <long> class TT> class D {}; + +int main() +{ + D<C> d; // ERROR - args not match +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp5.C new file mode 100755 index 0000000..4b835e8 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp5.C @@ -0,0 +1,15 @@ +// Build don't link: + +template<int> class D +{ +}; + +template<template<int> class D,class E> class C +{ + D<int> d; // ERROR - arg not match +}; + +int main() +{ + C<D,int> c; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp50.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp50.C new file mode 100755 index 0000000..4892e0c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp50.C @@ -0,0 +1,7 @@ +template <class T, template <T> class TT> class C {}; +template <int> class D {}; + +int main() +{ + C<int,D> c; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp51.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp51.C new file mode 100755 index 0000000..9a497b7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp51.C @@ -0,0 +1,13 @@ +template<class E, int i, class F, class G=int, int j=i, class H=E> class D +{ +}; + +template<template<class,int,class,class> class D,class E> class C +{ + D<E,2,char,bool> d; +}; + +int main() +{ + C<D,int> c; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp52.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp52.C new file mode 100755 index 0000000..fb841b9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp52.C @@ -0,0 +1,18 @@ +// Build don't link: + +template<class A,class B> class mymap {}; + +template<class Key, + class Value, + template<class, class > class MapT> +class base +{ + +}; + +// specialization +template<class Key, class Value> +class base<Key, Value, mymap<int, int > > +{ // ERROR - type/value mismatch + +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp53.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp53.C new file mode 100755 index 0000000..e5e87b4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp53.C @@ -0,0 +1,35 @@ +// Build don't link: + +// Submitted by Erez Louidor Lior <s3824888@techst02.technion.ac.il> + +template <typename> class H; +template <typename Target, typename Source> +H<Target> foo(const H<Source>&); + +template <typename Type> +class H{ + +#ifdef OK +public: +#endif + template<template<class, class> class Caster, typename Source> + static H<Type> cast(const H<Source>& s); + +#ifndef OK + template <typename Target, typename Source> + friend H<Target> foo(const H<Source>&); +#endif + +}; + +template <class, class> class caster; + +template <typename Target, typename Source> +H<Target> foo(const H<Source>& s){ + return H<Target>::template cast<caster, Source>(s); +} + +int main(){ + H<int> i; + foo<const int>(i); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp54.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp54.C new file mode 100755 index 0000000..bae649a --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp54.C @@ -0,0 +1,20 @@ +// Build don't link: + +// Reported by Bruce Eckel <Bruce@EckelObjects.com> + +// [temp.deduct.type] +// Make sure we treat <T> in the construct TT<T> as any type containing T. + +template <class T> class C +{ +}; + +template <class T, template <class> class TT> void f (TT<T *> &t) +{ +} + +int main () +{ + C<char *> c; + f(c); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp6.C new file mode 100755 index 0000000..cdea182 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp6.C @@ -0,0 +1,13 @@ +template<int> class F +{ +}; + +template<template<int> class D,class E> class C +{ + D<1> d; +}; + +int main() +{ + C<F,int> c; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp7.C new file mode 100755 index 0000000..0b98217 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp7.C @@ -0,0 +1,15 @@ +// Build don't link: + +template<class E> class D +{ +}; + +template<template<class> class D,class E> class C // ERROR - ref below +{ + D<int,int> d; // ERROR - arg not match +}; + +int main() +{ + C<D,int> c; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp8.C new file mode 100755 index 0000000..fd2a67c --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp8.C @@ -0,0 +1,17 @@ +template<class E> class DD +{ +}; + +template<int> class D +{ +}; + +template<template<class> class D,class E> class C +{ + D<E> d; +}; + +int main() +{ + C<DD,int> c; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp9.C new file mode 100755 index 0000000..3892b6e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/ttp9.C @@ -0,0 +1,13 @@ +template<class E,class F=int> class D +{ +}; + +template<template<class> class D,class E> class C +{ + D<E> d; +}; + +int main() +{ + C<D,int> c; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typedef1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typedef1.C new file mode 100755 index 0000000..8d674c9 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typedef1.C @@ -0,0 +1,18 @@ +// Testcase for handling of typedef wierdness. +// Build don't link: + +template <class T> +struct A +{ + typedef enum + { + foo + } B; + + A (B b); +}; + +template <class T> +A<T>::A (B b) +{ +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typedef2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typedef2.C new file mode 100755 index 0000000..18802fc --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typedef2.C @@ -0,0 +1,20 @@ +// Build don't link: + +typedef const int cint; + +template<class T> +class A +{ +public: + T f(cint i); +}; + +template <class T> +T A<T>::f(cint i) +{ +} + +int main() +{ + A<int> a; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typedef3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typedef3.C new file mode 100755 index 0000000..110e481 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typedef3.C @@ -0,0 +1,25 @@ +// Build don't link: + +template <class T> +void f(T, T) +{ +} + +struct A { + typedef enum { + VAL1 + } result_t; +}; + +struct B { + typedef enum { + VAL2 + } result_t; +}; + + +void g() +{ + f(A::VAL1, A::VAL1); + f(B::VAL2, B::VAL2); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename1.C new file mode 100755 index 0000000..c34eff1 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename1.C @@ -0,0 +1,27 @@ +// Build don't link: + +template<class T> +struct A { + typedef T T1; +}; + +template<class T> +struct B { + typedef T T2; +}; + +template<class T> +struct C { +}; + +template<class E> +C<typename E::T2::T1> +foo (E) +{ + return C<typename E::T2::T1>(); +} + +void test() +{ + foo(B<A<int> >()); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename10.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename10.C new file mode 100755 index 0000000..1b122b2 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename10.C @@ -0,0 +1,7 @@ +// Build don't link: + +struct S { + typedef int I; +}; + +void f(typename S::I); // ERROR - using typename outside of template diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename11.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename11.C new file mode 100755 index 0000000..1b4a1d5 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename11.C @@ -0,0 +1,15 @@ +// Build don't link: +// Special g++ Options: + +template <class T, int I> +struct S { + struct X {}; +}; + +template <class T, class U, int I> +S<T,I>::X f(T, U) +{ + S<T, I>::X(); +} + +template S<int, 3>::X f<int, double, 3>(int, double); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename12.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename12.C new file mode 100755 index 0000000..cef6700 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename12.C @@ -0,0 +1,31 @@ +// Special g++ Options: +// execution test - XFAIL *-*-* +// excess errors test - XFAIL *-*-* + +int i = 0; + +template <class T> +struct S { + struct X {}; +}; + +template <class T> +void f(T) +{ + S<T>::X(); +} + +template <> +struct S<int> { + static void X() { i = 1; } +}; + +int main() +{ + f(3); + if (i != 1) + return 1; + else + return 0; +} + diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename13.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename13.C new file mode 100755 index 0000000..48d12e6 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename13.C @@ -0,0 +1,37 @@ +// Build don't link: +// Special g++ Options: +// excess errors test - XFAIL *-*-* + +template <class T> +struct B +{ + typedef int I; +}; + + +template <class T> +struct D : public B<T> +{ + void f(); +}; + + +template <class T> +void D<T>::f() +{ + I(); +} + + +template <> +struct B<int> +{ + void I(); +}; + + +int main() +{ + D<int> di; + di.f(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename14.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename14.C new file mode 100755 index 0000000..7365b66 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename14.C @@ -0,0 +1,15 @@ +// Build don't link: +// Special g++ Options: + +template <class T> +struct B { + typedef T X; +}; + +template <class T> +struct S : public B<T> +{ + struct I { + void f(X x); + }; +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename2.C new file mode 100755 index 0000000..f2f2265 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename2.C @@ -0,0 +1,21 @@ +// Build don't link: + +class Base { +public: + class Bar { public: virtual ~Bar() {}; }; +}; + +class Derived : public Base { +public: + class Bar : public Base::Bar {}; +}; + +template <class T> +struct XYZ : public T::Bar { + XYZ(): T::Bar() { } +}; + +void test() { + XYZ<Base> b; + XYZ<Derived> d; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename3.C new file mode 100755 index 0000000..0b19d54 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename3.C @@ -0,0 +1,21 @@ +// Build don't link: +// Special g++ Options: + +template <class T> +struct A +{ + typedef T A_Type; +}; + + +template <class U> +struct B : public A<U> +{ + A_Type Func(); +}; + + +template <class U> +A<U>::A_Type B<U>::Func() +{ +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename4.C new file mode 100755 index 0000000..6f9362f --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename4.C @@ -0,0 +1,27 @@ +// Build don't link: +// Special g++ Options: + +template <class T> +struct A +{ + typedef T A_Type; +}; + + +template <class U> +struct B : public A<U> +{ +}; + + +template <class U> +struct C : public B<U> +{ + A_Type Func(); +}; + + +template <class U> +C<U>::A_Type C<U>::Func() +{ +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename5.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename5.C new file mode 100755 index 0000000..e967d14 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename5.C @@ -0,0 +1,27 @@ +// Build don't link: +// Special g++ Options: + +template <class T> +struct A +{ + typedef T A_Type; +}; + + +template <class U> +struct B : public A<U> +{ +}; + + +template <class U> +struct C : public B<U> +{ + void Func(A_Type); +}; + + +template <class U> +void C<U>::Func(A_Type) +{ +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename6.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename6.C new file mode 100755 index 0000000..0b19d54 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename6.C @@ -0,0 +1,21 @@ +// Build don't link: +// Special g++ Options: + +template <class T> +struct A +{ + typedef T A_Type; +}; + + +template <class U> +struct B : public A<U> +{ + A_Type Func(); +}; + + +template <class U> +A<U>::A_Type B<U>::Func() +{ +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename7.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename7.C new file mode 100755 index 0000000..5c89603 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename7.C @@ -0,0 +1,20 @@ +// Test for implicit typename +// Build don't link: +// Special g++ Options: + +template <class T> +struct A { +protected: + typedef struct B { } B; +}; + +template <class T> +struct C { }; + +template <class T> +struct D : public A <C <T> > { + void f () + { + B* new_entries = (B *) 0; + } +}; diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename8.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename8.C new file mode 100755 index 0000000..d2eb4ce --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename8.C @@ -0,0 +1,27 @@ +// Build don't link: + +template < class T > class A +{ +public: + typedef typename T::myT anotherT; // ERROR - undefined type + + anotherT t; // ERROR - undefined type + + A(anotherT _t) { // ERROR - undefined type + t=_t; + } + + anotherT getT() { + return t; + } +}; + +class B : public A< B > +{ +public: + typedef int myT; +}; + +int main() { + B b; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/typename9.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename9.C new file mode 100755 index 0000000..027d0a0 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/typename9.C @@ -0,0 +1,16 @@ +// Test to make sure that implicit typename doesn't break name binding rules. +// Special g++ Options: -w + +typedef double A; +template<class T> class B { + typedef char A; +}; +template<class T> struct X : B<T> { + A a; +}; + +int main() +{ + X<char*> x; + return sizeof (x.a) != sizeof (double); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/unify1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/unify1.C new file mode 100755 index 0000000..283e2f5 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/unify1.C @@ -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); diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/unify2.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/unify2.C new file mode 100755 index 0000000..89b043d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/unify2.C @@ -0,0 +1,27 @@ +// Build don't link: + +template <class T> +struct S +{ + typedef T S_Type; +}; + + +template <class T> +void foo(typename S<T>::S_Type) +{ +} + + +template <class T> +void foo(T) +{ +} + + +struct S2 {}; + +void bar() +{ + foo(S2()); // We can't unify with the first foo, so we get the second. +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/unify3.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/unify3.C new file mode 100755 index 0000000..847dc0e --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/unify3.C @@ -0,0 +1,22 @@ +// Build don't link: + +template <class T1, class T2> +struct ComputeBinaryType +{ +}; + +template<class T1> +struct ComputeBinaryType<T1, double> { + void g(); +}; + +template<class T1> +struct ComputeBinaryType<T1&, double> { + void h(); +}; + +void f() +{ + ComputeBinaryType<double, double> cb; + cb.g(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/unify4.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/unify4.C new file mode 100755 index 0000000..259920d --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/unify4.C @@ -0,0 +1,11 @@ +template <class T> void f (T); + +void g (); +void g (int); + +int +main () +{ + f (g); // ERROR - ambiguous unification + return 0; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/union1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/union1.C new file mode 100755 index 0000000..a1da446 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/union1.C @@ -0,0 +1,18 @@ +// Build don't link: + +union Un {int i;}; + +template<class T1, class T2> struct St1 {}; +template<class T> struct St1<Un,T> {}; + +template<class T> struct St2 {}; +template<> struct St2<Un> {}; + +template<class T1, class T2> struct St3 {}; +template<> struct St3<Un,int> {}; + +void f() { + St1<int,int> s1; + St2<int> s2; + St3<int,int> s3; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/vaarg.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/vaarg.C new file mode 100755 index 0000000..56ae0d4 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/vaarg.C @@ -0,0 +1,28 @@ +#include <stdarg.h> + +extern "C" void abort(); + +template <class T> +T* f(T t, ...) +{ + va_list ap; + + va_start(ap, t); + T* r = va_arg(ap, T*); + va_end(ap); + + return r; +} + + +struct S +{ +}; + +int main() +{ + S s; + + if (f(s, &s) != &s) + abort(); +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/vbase1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/vbase1.C new file mode 100755 index 0000000..58d26fc --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/vbase1.C @@ -0,0 +1,31 @@ +// Check that template classes handle inherited virtual bases +// properly, initializing them before direct non-virtual bases. + +int aflag; + +struct A +{ + A() { aflag = 1; } +}; + +struct B : virtual public A +{ + B() { } +}; + +struct C +{ + C() { if (!aflag) exit (1); } +}; + +template<class Parent> +struct D : public C, public Parent +{ + D() { } +}; + +int +main () +{ + D<B> c; +} diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/virtual1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/virtual1.C new file mode 100755 index 0000000..efa97b7 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/virtual1.C @@ -0,0 +1,6 @@ + struct V { virtual ~V() {} }; + template <class T> struct A : virtual V { }; + template <class T> struct B { + virtual void f() { T foo; } + }; + int main() { B< A<int> > bar; } diff --git a/gcc_arm/testsuite/g++.old-deja/g++.pt/warn1.C b/gcc_arm/testsuite/g++.old-deja/g++.pt/warn1.C new file mode 100755 index 0000000..96ed148 --- /dev/null +++ b/gcc_arm/testsuite/g++.old-deja/g++.pt/warn1.C @@ -0,0 +1,27 @@ +// Build don't link: +// Special g++ Options: -Wunused + +template <class T> +struct S +{ + struct R + { + R(); + ~R(); + }; + + void foo() + { + R r; // no warning + int i; // WARNING - unused + } + + S(); + ~S(); +}; + +void f() +{ + S<int> si; + si.foo(); +} |