Hi all, I was recently trying to gauge my operator overloading/template abilities and as a small test, created the Container class below. While this code compiles fine and works correctly under MSVC 2008 (displays 11), both MinGW/GCC and Comeau choke on the operator+ overload. As I trust them more than MSVC, I'm trying to figure out what I'm doing wrong.
Here is the code:
#include <iostream>
using namespace std;
template <typename T>
class Container
{
      friend Container<T> operator+ <> (Container<T>& lhs, Container<T>& rhs);
   public: void setobj(T ob);
     T getobj();
      private: T obj;
};
template <typename T>
void Container<T>::setobj(T ob)
{
   obj = ob;
}
template <typename T>
T Container<T>::getobj()
{
   return obj;
}
template <typename T>
Container<T> operator+ <> (Container<T>& lhs, Container<T>& rhs)
{
      Container<T> temp;
      temp.obj = lhs.obj + rhs.obj;
      return temp;
}
int main()
{    
    Container<int> a, b;
 a.setobj(5);
    b.setobj(6);
 Container<int> c = a + b;
 cout << c.getobj() << endl;
    return 0;
}
This is the error Comeau gives:
Comeau C/C++ 4.3.10.1 (Oct  6 2008 11:28:09) for ONLINE_EVALUATION_BETA2
Copyright 1988-2008 Comeau Computing.  All rights reserved.
MODE:strict errors C++ C++0x_extensions
"ComeauTest.c", line 27: error: an explicit template argument list is not allowed
          on this declaration
  Container<T> operator+ <> (Container<T>& lhs, Container<T>& rhs)
               ^
1 error detected in the compilation of "ComeauTest.c".
I'm having a hard time trying to get Comeau/MingGW to play ball, so that's where I turn to you guys. It's been a long time since my brain has melted this much under the weight of C++ syntax, so I feel a little embarrassed ;).
Thanks in advance.
EDIT: Eliminated an (irrelevant) lvalue error listed in initial Comeau dump.