This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problems with templates and gcc


> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]