1// { dg-do run } 2// Test for partial specialization of a member function template. 3// Origin: Jason Merrill <jason@cygnus.com> 4 5template <class T> struct A { 6 template <class U> int f(U) { return 42; } 7}; 8 9template <> 10template <class U> 11int A<char>::f(U); 12 13template <> 14template <class U> 15int A<double>::f(U) { return 24; } 16 17int main () 18{ 19 A<int> ai; 20 if (ai.f(0) != 42) 21 return 1; 22 23 A<double> ad; 24 if (ad.f(0) != 24) 25 return 1; 26 27 A<char> ac; 28 if (ac.f(0) != 36) 29 return 1; 30} 31 32template <> 33template <class U> 34int A<char>::f(U) { return 36; } 35