I
infogoogle
Hello,
i'm having problems with the type of a template function:
This code:
class A {};
class B : A {};
template<class T> B* fnull() { return 0; };
typedef A *(*afun)() ;
afun nn = fnull<int>;
produces the following error
pointer-to-template-instantiation.cpp:8: error: no matches converting
function `null' to type `class A*(*)()'
pointer-to-template-instantiation.cpp:4: error: candidates are:
template<classT> B* null()
When I change the return type to "A*" , or when I remove the
template<...>, this error disappears, so it seems to be the combination
of the two somehow. Any suggestions?
--
Johannes Leitner
Software Engineering Group
http://www.inf.uni-konstanz.de/~leitner
University of Constance Phone: (+49 7531)
88-2188
78457 Konstanz Fax: (+49 7531)
88-3577
Germany Office: Building E, Room
222
i'm having problems with the type of a template function:
This code:
class A {};
class B : A {};
template<class T> B* fnull() { return 0; };
typedef A *(*afun)() ;
afun nn = fnull<int>;
produces the following error
pointer-to-template-instantiation.cpp:8: error: no matches converting
function `null' to type `class A*(*)()'
pointer-to-template-instantiation.cpp:4: error: candidates are:
template<classT> B* null()
When I change the return type to "A*" , or when I remove the
template<...>, this error disappears, so it seems to be the combination
of the two somehow. Any suggestions?
--
Johannes Leitner
Software Engineering Group
http://www.inf.uni-konstanz.de/~leitner
University of Constance Phone: (+49 7531)
88-2188
78457 Konstanz Fax: (+49 7531)
88-3577
Germany Office: Building E, Room
222