Problems with templates and gcc
Martin v. Loewis
martin@loewis.home.cs.tu-berlin.de
Thu Mar 16 12:45:00 GMT 2000
> The idea is to have a first template function with 2 arguments. A second
> function has the same name but with 1 argument and call the first function
> using his argument and another by default.
Thanks for your bug report. I had a number of problems reproducing it.
> The code works good if the functions are declared and defined in the
> class (this is the configuration activ in the file below).
[...]
> template<class U,bool b> T* Get(const U &u);
> {
> return(0);
> }
It does work good? For me, it gives the error
a.cc:9: parse error before `{'
a.cc:12: semicolon missing after declaration of `Dummy<T,O>'
which I think is a correct error message. If I remove the semicolons,
it compiles fine.
> template<class T,bool O> template<class U,bool b>
> T* Get(const U &u)
> {
> return(0);
> }
In this declaration, how is the compiler supposed to know that you
refer to a method of Dummy? You need to put the class template name in
here somewhere, although I'm not sure about the syntax - please ask in
one of the C++ groups.
Martin
More information about the Gcc
mailing list