From: Jason Merrill Date: Fri, 26 Sep 1997 03:13:35 +0000 (-0400) Subject: add X-Git-Tag: releases/egcs-1.0.0~465 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3055528c86920967f163f990599d6b0810a47a97;p=thirdparty%2Fgcc.git add From-SVN: r15718 --- 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 000000000000..0daf54f2373d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit1.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T t) {} + +void bar() +{ + &foo; +} 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 000000000000..d90b8d051973 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit10.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T t); + +int main() +{ + foo(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 000000000000..fb7834f1a20a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit11.C @@ -0,0 +1,14 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T t); + +template +struct S {}; + +int main() +{ + S si; + + foo >(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 000000000000..83ebcc16cc78 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit12.C @@ -0,0 +1,17 @@ +// Build don't run: +// GROUPS passed templates +template +struct S +{ + template + void foo(T t); + + template <> + void foo(int) {} +}; + +int main() +{ + S s; + s.template foo(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 000000000000..73e0e19e85f0 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit13.C @@ -0,0 +1,21 @@ +// Build don't run: +// GROUPS passed templates + +template +struct S +{ + template + void foo(T t); + + template <> + void foo(int) { } + + template + void bar(T t) { this->template foo(3.74); } +}; + +int main() +{ + S 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 000000000000..aa9d03fca75c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit14.C @@ -0,0 +1,14 @@ +// Build don't link: +// GROUPS passed templates +template +struct S +{ + template + typename U::R foo(U u); +}; + + +void bar() +{ + S 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 000000000000..290da42192d4 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit15.C @@ -0,0 +1,30 @@ +// Build don't link: +// GROUPS passed templates +template +class Array; + + +template +class ArraySectionInfo { +public: + enum { rank = 0 }; +}; + + +template +class SliceInfo { +public: + enum { + rank = ArraySectionInfo::rank + }; + + typedef Array T_slice; +}; + +template +typename SliceInfo::T_slice +foo(T2 r2) +{ + return SliceInfo::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 000000000000..c7a87339ca18 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit16.C @@ -0,0 +1,28 @@ +// Build don't link: +// GROUPS passed templates +template +class Array; + + +template +class ArraySectionInfo { +public: + enum { rank = 0 }; +}; + + +template +class SliceInfo { +public: + static const int rank = ArraySectionInfo::rank; + + typedef Array T_slice; +}; + +template +typename SliceInfo::T_slice +foo(T2 r2) +{ + return SliceInfo::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 000000000000..8e8688df3219 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit17.C @@ -0,0 +1,22 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(U u, T t); + +template +void foo(T t); + +template +struct S {}; + +template +void foo(const S&); + +void bar() +{ + void (*fn)(double, int) = + (void (*)(double, int)) &foo; + void (*fn2)(double) = foo; + foo(3, 3.0); + foo(S()); +} 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 000000000000..20c4b75d11e3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit18.C @@ -0,0 +1,11 @@ +// Build don't run: +// GROUPS passed templates +template +int foo(T t) { return 0; } + +int foo(int i); + +int main() +{ + return foo(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 000000000000..b209bbe8672a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit19.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template +int foo(T t); + +template <> +int foo(int i) { return 0; } + +int main() +{ + return foo(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 000000000000..4d88c397f7da --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit2.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T t) {} + +void bar() +{ + (void (*)(int)) &foo; +} 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 000000000000..487d263ccbc2 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit20.C @@ -0,0 +1,7 @@ +// Build don't link: +// GROUPS passed templates +template +T foo(T t); + +template <> +int foo(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 000000000000..a99a49bae4ba --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit21.C @@ -0,0 +1,10 @@ +// Build don't link: +// GROUPS passed templates +template +T foo(T* t); + +template <> +int foo(char c); // ERROR - does not match declaration. + +template <> +int bar(); // 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 000000000000..a0120944548a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C @@ -0,0 +1,10 @@ +// Build don't link: +// GROUPS passed templates +template +T foo(T t, U* u); + +template +T foo(T t, T* t); + +template <> +int foo(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 000000000000..cdffb15bc66a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit23.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template +int foo(T t) { return 1; } + +template <> +int foo(int i) { return 0; } + +int main() +{ + return foo(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 000000000000..42f4c3cb1a2e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit24.C @@ -0,0 +1,7 @@ +// Build don't link: +// GROUPS passed templates +template +int foo(T t); + +int foo(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 000000000000..022521695f84 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit25.C @@ -0,0 +1,13 @@ +// Build don't link: +// GROUPS passed templates +template +class S {}; + +template +void foo(T t, S); + +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 000000000000..eba8d79e2926 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit26.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template +int foo(T t) { return 1; } + +template <> +int foo(int i) { return 0; } + +int main() +{ + &foo; +} 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 000000000000..4a5adb59e70c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit27.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template +void foo(T t); + +template <> +void foo(int i) {} + +int main() +{ + &foo; +} 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 000000000000..b842b8932891 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit28.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template +int foo(T t) { return 1; } + +template <> +int foo(int i) { return 0; } + +int main() +{ + return (*&foo)(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 000000000000..a247779f8b38 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit29.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template +int foo(T) { return 0; } + +int foo(int); + +int main() +{ + return foo(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 000000000000..2a5309fb4edf --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit3.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T t, U u) {} + +void bar() +{ + (void (*)(double, int)) &foo; +} 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 000000000000..5a697135c46b --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit30.C @@ -0,0 +1,11 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T, T*); + + +void bar() +{ + double d; + (*((void (*)(int, double*)) &foo))(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 000000000000..61190f7f5f19 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit31.C @@ -0,0 +1,16 @@ +// Build don't run: +// GROUPS passed templates +template +struct S +{ + template + static double foo(U u) { return (double) u; } +}; + + +int main() +{ + double d = S::template foo(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 000000000000..7c0e28521f03 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit32.C @@ -0,0 +1,25 @@ +// Build don't link: +// GROUPS passed templates +template +struct S +{ +}; + + +template <> +struct S +{ + void foo(); +}; + +template <> +void S::foo() +{ +} + + +void bar() +{ + S 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 000000000000..048a3565be8c --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit33.C @@ -0,0 +1,9 @@ +// Build don't link: +// GROUPS passed templates +template +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 000000000000..40c1da0aeb9d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit34.C @@ -0,0 +1,10 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T t); + +template <> +void foo(int) {}; // ERROR - redefinition. + +template <> +void foo(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 000000000000..9f7144274592 --- /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 + void foo(T t); + + template <> + void foo(int i) { } +}; + +int main() +{ + S s; + s.template foo(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 000000000000..911e7b3a20a3 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit4.C @@ -0,0 +1,19 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T t); + +template +struct S {}; + +template +void bar(T t) +{ + void (*f)(S ) = &foo >; +} + + +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 000000000000..2c2b7637421a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit5.C @@ -0,0 +1,19 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T t) {} + +template +struct S {}; + +template +void bar(T t) +{ + void (*f)(S ) = &foo >; +} + + +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 000000000000..1ee7751b5558 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit6.C @@ -0,0 +1,12 @@ +// Build don't run: +// GROUPS passed templates +template +int foo(T t); + +template <> +int foo(int i) { return 0; } + +int main() +{ + return foo(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 000000000000..9f7144274592 --- /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 + void foo(T t); + + template <> + void foo(int i) { } +}; + +int main() +{ + S s; + s.template foo(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 000000000000..777c5d4afc2a --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit8.C @@ -0,0 +1,13 @@ +// Build don't link: +// GROUPS passed templates +template +void foo(T t, U u); + +template +void foo(double, U) {} + +void baz() +{ + foo(3.0, "abc"); + foo("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 000000000000..908374b720af --- /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(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 000000000000..99e4f7299eba --- /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 S +{ + S(const S& x) {} + + template + S(const S& 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 000000000000..d67da394c3e9 --- /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 + 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 000000000000..2efd4d6d73c9 --- /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 + 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/nontype1.C b/gcc/testsuite/g++.old-deja/g++.pt/nontype1.C new file mode 100644 index 000000000000..588f8e62c208 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/nontype1.C @@ -0,0 +1,17 @@ +template +struct B +{ + B(); + ~B(); +}; +template +struct D +{ + D(int r0); + D(B &, int); +}; +template +void func() +{ + D 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 000000000000..7126200a5c5e --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/syntax1.C @@ -0,0 +1,18 @@ +struct X { + enum { + a = 0, + n = 0 + }; +}; + +template +struct Y { + + enum { + a = T1::a + T2::a, + + n = meta_max::max // Crash here. + }; +}; + +int z = Y::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 000000000000..38fd79e84075 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/typename1.C @@ -0,0 +1,25 @@ +template +struct A { + typedef T T1; +}; + +template +struct B { + typedef T T2; +}; + +template +struct C { +}; + +template +C +foo (E) +{ + return C(); +} + +void test() +{ + foo(B >()); +} 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 000000000000..2b9fc7a03988 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/warn1.C @@ -0,0 +1,24 @@ + template + struct S + { + struct R + { + R(); + ~R(); + }; + + void foo() + { + R r; + int i; + } + + S(); + ~S(); + }; + + void f() + { + S si; + si.foo(); + }