g++ compile error in unused template

Jonathan Wakely jwakely.gcc@gmail.com
Tue Feb 7 15:17:00 GMT 2012


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> >();



More information about the Gcc-help mailing list