g++ compile error in unused template

Michal Sojka sojka@os.inf.tu-dresden.de
Tue Feb 7 15:36:00 GMT 2012


On Tue, 07 Feb 2012, Jonathan Wakely wrote:
> On 7 February 2012 15:16, Jonathan Wakely wrote:
> > On 7 February 2012 14:29, Michal Sojka wrote:
> >> Hi list,
> >>
> >> does anyone know why I get the following error when compiling this code?
> >
> > The syntax is invalid.
> >
> >> template<class T>
> >> struct Base {
> >>        template <class A>
> >>        void func() {}
> >> };
> >>
> >> template<class T>
> >> struct Child : public Base<T> {
> >>        unsigned func2() {
> >>                Base<T>::func< Child<T> >();
> >
> > You must tell the compiler that func is a template:
> >
> >               Base<T>::template func< Child<T> >();
> 
> See http://womble.decadent.org.uk/c++/template-faq.html#disambiguation
> for more details.

Yes, that is. Thank you both very much.

-Michal



More information about the Gcc-help mailing list