views:

81

answers:

1

Here's my code. It compiles in VS2005 but not in gcc. Any ideas

template<class T>
Derived<T>::Derived(const Derived<T>& in) 
{
    Base<T>::Base<T>(in); //ERROR here
}

"expected primary-expression before > token"

+1  A: 

You can't call constructors explicitly like that (if VS2005 allows you to, it's a compiler-specific extension). The correct way to pass an argument to your parent class's constructor is:

template<class T>
Derived<T>::Derived(const Derived<T>& in) 
  : Base<T>(in)
{
}
Tyler McHenry