1// { dg-do run } 2 3// Copyright (C) 2001 Free Software Foundation, Inc. 4// Contributed by Nathan Sidwell 29 Dec 2001 <nathan@codesourcery.com> 5 6// PR 4361. Template conversion operators were not overloaded. 7 8class C 9{ 10public: 11 12 operator float () {return 2;} 13 14 operator int () 15 { 16 return 0; 17 } 18 19 template<typename T> 20 operator int () 21 { return 1; 22 } 23}; 24 25int main () 26{ 27 C p; 28 int r; 29 30 r = p.operator int (); 31 if (r) 32 return r; 33 r = static_cast <int> (p); 34 35 if (r) 36 return r + 2; 37 38 return 0; 39} 40