From fca482568a40e38c9c95938128bc01c473b9587f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 28 Jan 1998 05:58:52 -0500 Subject: [PATCH] new From-SVN: r17530 --- .../g++.old-deja/g++.pt/explicit20.C | 2 +- .../g++.old-deja/g++.pt/explicit22.C | 6 +-- gcc/testsuite/g++.old-deja/g++.pt/local3.C | 8 +++- gcc/testsuite/g++.old-deja/g++.pt/memtemp18.C | 2 +- gcc/testsuite/g++.old-deja/g++.pt/memtemp64.C | 21 ++++++++++ gcc/testsuite/g++.old-deja/g++.pt/spec12.C | 21 ++++++++++ gcc/testsuite/g++.old-deja/g++.pt/spec13.C | 42 +++++++++++++++++++ 7 files changed, 95 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/memtemp64.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/spec12.C create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/spec13.C diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit20.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit20.C index 487d263ccbc..918ff3a44f7 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit20.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit20.C @@ -4,4 +4,4 @@ template T foo(T t); template <> -int foo(char c); // ERROR - bad return type. +int foo(char c); // ERROR - does not match any template declaration diff --git a/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C b/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C index a0120944548..2cb23381653 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/explicit22.C @@ -1,10 +1,10 @@ // Build don't link: // GROUPS passed templates template -T foo(T t, U* u); +T foo(T t, U* u); // ERROR - template candidate template -T foo(T t, T* t); +T foo(T t, T* t); // ERROR - template candidate template <> -int foo(int, int*); // ERROR - ambiguous specialization. +int foo(int, int*); // ERROR - ambiguous template specialization diff --git a/gcc/testsuite/g++.old-deja/g++.pt/local3.C b/gcc/testsuite/g++.old-deja/g++.pt/local3.C index 58c2627cb3c..ea1b386b254 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/local3.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/local3.C @@ -3,15 +3,19 @@ extern "C" void abort(); template void f(T) { + int j; + + j = 6; + struct S { int i; }; S s; - s.i = 3; + s.i = j; - if (s.i != 3) + if (s.i != 6) abort(); } diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp18.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp18.C index c9b76c33145..638e5e33852 100644 --- a/gcc/testsuite/g++.old-deja/g++.pt/memtemp18.C +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp18.C @@ -3,7 +3,7 @@ struct S { template - void foo(T); + void foo(T) {} }; template void S::foo(int); diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp64.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp64.C new file mode 100644 index 00000000000..6185d3d6058 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp64.C @@ -0,0 +1,21 @@ +// Build don't link: + +template +struct S1 {}; + +template +void f(T); + +template +struct S2 +{ + template + void f >(T) {} // ERROR - bad specialization. +}; + + +template +struct S3 +{ + friend class S2; +}; diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec12.C b/gcc/testsuite/g++.old-deja/g++.pt/spec12.C new file mode 100644 index 00000000000..71676ff6cbc --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec12.C @@ -0,0 +1,21 @@ +extern "C" void abort(); + +template +struct S +{ + template + int f(U u); +}; + + +template +template <> +int S::f(int i) { return 1; } + +int main() +{ + S sc; + + if (sc.f(3) != 1) + abort(); +} diff --git a/gcc/testsuite/g++.old-deja/g++.pt/spec13.C b/gcc/testsuite/g++.old-deja/g++.pt/spec13.C new file mode 100644 index 00000000000..8f94570db84 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/spec13.C @@ -0,0 +1,42 @@ +template +void f(T t); + +template +void f(T* t); + +template <> +void f(int* ip) {} + +struct S1 +{ + template + void f(T t); + + template + void f(T* t); + + template <> + void f(int* ip) {} +}; + +template +struct S2 +{ + template + void f(T t); + + template + void f(T* t); + + template <> + void f(int* ip) {} +}; + +int main() +{ + int* ip; + S1 s1; + s1.f(ip); + S2 s2; + s2.f(ip); +} -- 2.30.2