diff options
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.pt/memtemp96.C')
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.pt/memtemp96.C | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/memtemp96.C b/gcc/testsuite/g++.old-deja/g++.pt/memtemp96.C new file mode 100644 index 000000000..52519fad6 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/memtemp96.C @@ -0,0 +1,34 @@ +// { dg-do run } +// Test for partial specialization of a member function template. +// Origin: Jason Merrill <jason@cygnus.com> + +template <class T> struct A { + template <class U> int f(U) { return 42; } +}; + +template <> +template <class U> +int A<char>::f(U); + +template <> +template <class U> +int A<double>::f(U) { return 24; } + +int main () +{ + A<int> ai; + if (ai.f(0) != 42) + return 1; + + A<double> ad; + if (ad.f(0) != 24) + return 1; + + A<char> ac; + if (ac.f(0) != 36) + return 1; +} + +template <> +template <class U> +int A<char>::f(U) { return 36; } |