Topic: template function signatures
Author: dschieb@muse.cv.nrao.edu (Darrell Schiebel)
Date: Mon, 6 Dec 1993 18:25:33 GMT Raw View
The following simple example compiles with both
Lucid's lcc and GNU's g++, but fails with Sun's
cfront based compiler. Should this work?
thanks,
Darrell Schiebel
PS: the error which the Sun compiler generates is:
--------------------------------------------------
"dum.cc", line 10: error: function template parameter t must be used in signature of dum()
"dum.cc", line 14: error: use of template function dum() does not match any of its template definitions
"dum.cc", line 14: error: template class foo not yet instantiated; please add an explicit instantiation ( typedef foo< types>)
-- -- -- -- -- -- -- -- -- -- -- --
#include <iostream.h>
template<class t> class bar {};
template<class t> class foo {};
template<class t> foo<bar<t> > dum(const foo<bar<t> > &) {
cout << "HERE" << endl;
foo<bar<t> > x;
return x;
}
main() {
foo<bar<int> > v;
dum(v);
}