diff options
author | Jason Merrill <jason@gcc.gnu.org> | 1997-09-25 23:13:35 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-09-25 23:13:35 -0400 |
commit | 3055528c86920967f163f990599d6b0810a47a97 (patch) | |
tree | fb099f8cc2a733cebe991009aca1779661bfd3d2 | |
parent | 5a4a879c40a08ecc539b09862dfd49435689c168 (diff) | |
download | gcc-3055528c86920967f163f990599d6b0810a47a97.zip gcc-3055528c86920967f163f990599d6b0810a47a97.tar.gz gcc-3055528c86920967f163f990599d6b0810a47a97.tar.bz2 |
add
From-SVN: r15718
42 files changed, 626 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit1.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit1.C new file mode 100644 index 0000000..0daf54f --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit10.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit10.C new file mode 100644 index 0000000..d90b8d0 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit11.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit11.C new file mode 100644 index 0000000..fb7834f --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit12.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit12.C new file mode 100644 index 0000000..83ebcc1 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit12.C @@ -0,0 +1,17 @@ +// Build don't run: +// GROUPS passed templates +template <class U> +struct S +{ + template <class T> + void foo(T t); + + template <> + void foo<int>(int) {} +}; + +int main() +{ + S<char*> s; + s.template foo<int>(3.0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit13.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit13.C new file mode 100644 index 0000000..73e0e19 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit13.C @@ -0,0 +1,21 @@ +// Build don't run: +// GROUPS passed templates + +template <class U> +struct S +{ + template <class T> + void foo(T t); + + template <> + void foo(int) { } + + template <class T> + void bar(T t) { this->template foo<U>(3.74); } +}; + +int main() +{ + S<int> s; + s.bar(3); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit14.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit14.C new file mode 100644 index 0000000..aa9d03f --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit15.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit15.C new file mode 100644 index 0000000..290da42 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit16.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit16.C new file mode 100644 index 0000000..c7a8733 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit17.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit17.C new file mode 100644 index 0000000..8e8688d --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit18.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit18.C new file mode 100644 index 0000000..20c4b75 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit19.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit19.C new file mode 100644 index 0000000..b209bbe --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit2.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit2.C new file mode 100644 index 0000000..4d88c39 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit20.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit20.C new file mode 100644 index 0000000..487d263 --- /dev/null +++ b/gcc/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 - bad return type. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit21.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit21.C new file mode 100644 index 0000000..a99a49b --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit22.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C new file mode 100644 index 0000000..a012094 --- /dev/null +++ b/gcc/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); + +template <class T> +T foo(T t, T* t); + +template <> +int foo<int>(int, int*); // ERROR - ambiguous specialization. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit23.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit23.C new file mode 100644 index 0000000..cdffb15 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit24.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit24.C new file mode 100644 index 0000000..42f4c3c --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit25.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit25.C new file mode 100644 index 0000000..0225216 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit26.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit26.C new file mode 100644 index 0000000..eba8d79 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit27.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit27.C new file mode 100644 index 0000000..4a5adb5 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit28.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit28.C new file mode 100644 index 0000000..b842b89 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit29.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit29.C new file mode 100644 index 0000000..a247779 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit3.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit3.C new file mode 100644 index 0000000..2a5309f --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit30.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit30.C new file mode 100644 index 0000000..5a69713 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit31.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit31.C new file mode 100644 index 0000000..61190f7 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit32.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit32.C new file mode 100644 index 0000000..7c0e285 --- /dev/null +++ b/gcc/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(); +}; + +template <> +void S<int>::foo() +{ +} + + +void bar() +{ + S<int> si; + si.foo(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit33.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit33.C new file mode 100644 index 0000000..048a356 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit34.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit34.C new file mode 100644 index 0000000..40c1da0 --- /dev/null +++ b/gcc/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 - redefinition. + +template <> +void foo<int>(int) {} // ERROR - redefinition. diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit35.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit35.C new file mode 100644 index 0000000..9f71442 --- /dev/null +++ b/gcc/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 foo<int>(int i) { } +}; + +int main() +{ + S s; + s.template foo<int>(3.0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit4.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit4.C new file mode 100644 index 0000000..911e7b3 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit5.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit5.C new file mode 100644 index 0000000..2c2b763 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit6.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit6.C new file mode 100644 index 0000000..1ee7751 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit7.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit7.C new file mode 100644 index 0000000..9f71442 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit7.C @@ -0,0 +1,16 @@ +// Build don't run: +// GROUPS passed templates +struct S +{ + template <class T> + void foo(T t); + + template <> + void foo<int>(int i) { } +}; + +int main() +{ + S s; + s.template foo<int>(3.0); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit8.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit8.C new file mode 100644 index 0000000..777c5d4 --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/explicit9.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit9.C new file mode 100644 index 0000000..908374b --- /dev/null +++ b/gcc/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/testsuite/g++.old-deja/g++.pt/memtemp60.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp60.C new file mode 100644 index 0000000..99e4f72 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp60.C @@ -0,0 +1,10 @@ +// Build don't link: +// GROUPS passed membertemplates +template <class T> +class S +{ + S(const S<T>& x) {} + + template <class U> + S(const S<U>& x) {} +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp61.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp61.C new file mode 100644 index 0000000..d67da39 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp61.C @@ -0,0 +1,23 @@ +// Build don't run: +// GROUPS passed membertemplates +struct S +{ + template <class T> + void foo(T t); + + template <> + void foo(int i); +}; + + +template <> +void S::foo(int i) +{ +} + + +int main() +{ + S s; + s.foo(3); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp62.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp62.C new file mode 100644 index 0000000..2efd4d6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp62.C @@ -0,0 +1,23 @@ +// Build don't run: +// GROUPS passed membertemplates +struct S +{ + template <class T> + void foo(T t); + + template <> + void foo(int i); +}; + + +template <> +void S::foo<int>(int i) +{ +} + + +int main() +{ + S s; + s.foo(3); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/nontype1.C b/gcc/testsuite/g++.old-deja/g++.pt/nontype1.C new file mode 100644 index 0000000..588f8e6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/nontype1.C @@ -0,0 +1,17 @@ +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/testsuite/g++.old-deja/g++.pt/syntax1.C b/gcc/testsuite/g++.old-deja/g++.pt/syntax1.C new file mode 100644 index 0000000..7126200 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/syntax1.C @@ -0,0 +1,18 @@ +struct X { + enum { + a = 0, + n = 0 + }; +}; + +template<class T1, class T2> +struct Y { + + enum { + a = T1::a + T2::a, + + n = meta_max<T1::n,T2::n>::max // Crash here. + }; +}; + +int z = Y<X,X>::a; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/typename1.C b/gcc/testsuite/g++.old-deja/g++.pt/typename1.C new file mode 100644 index 0000000..38fd79e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename1.C @@ -0,0 +1,25 @@ +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/testsuite/g++.old-deja/g++.pt/warn1.C b/gcc/testsuite/g++.old-deja/g++.pt/warn1.C new file mode 100644 index 0000000..2b9fc7a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/warn1.C @@ -0,0 +1,24 @@ + template <class T> + struct S + { + struct R + { + R(); + ~R(); + }; + + void foo() + { + R r; + int i; + } + + S(); + ~S(); + }; + + void f() + { + S<int> si; + si.foo(); + } |