From 138928a69612cfe66459c6095eea555bf0f56646 Mon Sep 17 00:00:00 2001 From: Jason Merrill <jason@gcc.gnu.org> Date: Sun, 22 Feb 1998 22:18:11 -0500 Subject: [PATCH] new From-SVN: r18199 --- .../g++.old-deja/g++.other/cleanup1.C | 20 +++++++++++ .../g++.old-deja/g++.other/overcnv1.C | 15 +++++++++ gcc/testsuite/g++.old-deja/g++.pt/defarg2.C | 17 ++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend1.C | 24 ++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend10.C | 29 ++++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend11.C | 31 +++++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend12.C | 33 +++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend13.C | 33 +++++++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend3.C | 25 ++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend4.C | 21 ++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend5.C | 17 ++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend6.C | 28 ++++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend7.C | 25 ++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend8.C | 18 ++++++++++ gcc/testsuite/g++.old-deja/g++.pt/friend9.C | 22 +++++++++++++ .../g++.old-deja/g++.pt/instantiate2.C | 12 +++++++ gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C | 3 +- gcc/testsuite/g++.old-deja/g++.pt/memtemp70.C | 24 ++++++++++++++ gcc/testsuite/g++.old-deja/g++.pt/ttp42.C | 21 ++++++++++++ 19 files changed, 417 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/cleanup1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.other/overcnv1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/defarg2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend1.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend10.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend11.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend13.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend3.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend4.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend5.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend6.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend7.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend8.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/friend9.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/instantiate2.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/memtemp70.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/ttp42.C diff --git a/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C b/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C new file mode 100644 index 000000000000..ce373601ded3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/cleanup1.C @@ -0,0 +1,20 @@ +// Bug: fold is too eager about pushing down CLEANUP_POINT_EXPR. + +int d; + +struct A { + A() { } + ~A() { d = 1; } +}; + +int f (const A& a) +{ + return 1; +} + +main () +{ + if (f (A()) && d == 0) + return 0; + return 1; +} diff --git a/gcc/testsuite/g++.old-deja/g++.other/overcnv1.C b/gcc/testsuite/g++.old-deja/g++.other/overcnv1.C new file mode 100644 index 000000000000..05941df5ff0b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/overcnv1.C @@ -0,0 +1,15 @@ +// Build don't link: + +class A { +public: + void f(const char * const * ); +}; +void f(const char * const *) {} + +void g() +{ + char *ar[10]; + A a; + f(ar); + a.f(ar); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/defarg2.C b/gcc/testsuite/g++.old-deja/g++.pt/defarg2.C new file mode 100644 index 000000000000..444ecc40b50a --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend1.C b/gcc/testsuite/g++.old-deja/g++.pt/friend1.C new file mode 100644 index 000000000000..ba642ba5c5ae --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend10.C b/gcc/testsuite/g++.old-deja/g++.pt/friend10.C new file mode 100644 index 000000000000..bff432b5620b --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend11.C b/gcc/testsuite/g++.old-deja/g++.pt/friend11.C new file mode 100644 index 000000000000..d70fae6e0c87 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend12.C b/gcc/testsuite/g++.old-deja/g++.pt/friend12.C new file mode 100644 index 000000000000..ef9bfc8a02cd --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend13.C b/gcc/testsuite/g++.old-deja/g++.pt/friend13.C new file mode 100644 index 000000000000..251d52a47bc1 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend3.C b/gcc/testsuite/g++.old-deja/g++.pt/friend3.C new file mode 100644 index 000000000000..77aabd3bee30 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend4.C b/gcc/testsuite/g++.old-deja/g++.pt/friend4.C new file mode 100644 index 000000000000..ea439277c5a9 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend5.C b/gcc/testsuite/g++.old-deja/g++.pt/friend5.C new file mode 100644 index 000000000000..516be4dd018c --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend6.C b/gcc/testsuite/g++.old-deja/g++.pt/friend6.C new file mode 100644 index 000000000000..5651421e6cfb --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend7.C b/gcc/testsuite/g++.old-deja/g++.pt/friend7.C new file mode 100644 index 000000000000..2962d9245314 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend8.C b/gcc/testsuite/g++.old-deja/g++.pt/friend8.C new file mode 100644 index 000000000000..ffa9122728f3 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/friend9.C b/gcc/testsuite/g++.old-deja/g++.pt/friend9.C new file mode 100644 index 000000000000..63455d01a525 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/instantiate2.C b/gcc/testsuite/g++.old-deja/g++.pt/instantiate2.C new file mode 100644 index 000000000000..a5c6c49d16f2 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/memtemp58.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C index a64adeb8817d..38c295388d01 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp58.C @@ -18,7 +18,8 @@ struct A { template<int N2, class T, int N3> static void f(B<N2,T>, B<N3,T> b) { - D<N2,N3,N>::E::f(b); + typedef typename D<N2,N3,N>::E E; + E::f(b); } }; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp70.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp70.C new file mode 100644 index 000000000000..2a9fe8a2c354 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/ttp42.C b/gcc/testsuite/g++.old-deja/g++.pt/ttp42.C new file mode 100644 index 000000000000..b2610dfb123b --- /dev/null +++ b/gcc/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; +} -- GitLab