error while CC compiles templates
Hello!
I am stucked with the following problem.
I am trying to compile such piece of code:
template< template < class > class _Oper,
template<class, class> class _Meta, class _Dom > struct _UnClos;
GCC understands it perfectly and no errors iccure. While CC gives me such errors:
bash-2.03$ /opt/SUNWspro/bin/CC test.cc
"test.cc", line 9: Error: "," expected instead of "<".
"test.cc", line 9: Error: Type name expected instead of "<".
"test.cc", line 9: Error: "{" expected instead of ",".
-
Does anybody know why CC doesn't understand this?
[640 byte] By [
dima.ru] at [2007-11-26 7:50:34]

# 3
It look like I need complete test case from you to reproduce the problem. Simple test case works fine:
% cat test.cc
template< template < class > class _Oper, template<class, class> class _Meta, class _Dom > struct _UnClos;
int main()
{
}
% CC -V test.cc
CC: Sun C++ 5.8 Patch 121017-02 2006/04/19
c++filt: Sun C++ 5.8 2005/10/13
ccfe: Sun C++ 5.8 Patch 121017-02 2006/04/19
ld: Software Generation Utilities - Solaris Link Editors: 5.10-1.482
# 4
Here is my test case:
-
bash-2.03$ cat test.cc
#include <stdio.h>
#include <iostream.h>
#include <map>
using namespace std;
typedef map<int, map><int, int> > ii_map;
template< template < class > class _Oper,
template<class, class> class _Meta, class _Dom > struct _UnClos;
int main(){
ii_map imap;
cout<<"Hello"<<endl;
return 0;
}
And here what I get:
bash-2.03$ /opt/SUNWspro/bin/CC -V test.cc
CC: Sun C++ 5.5 2003/03/12
ccfe: Sun C++ 5.5 2003/03/12
"test.cc", line 9: Error: "," expected instead of "><".
"test.cc", line 9: Error: Type name expected instead of "<".
"test.cc", line 9: Error: "{" expected instead of ",".
3 Error(s) detect
# 7
Solaris is not shipped with Sun compilers. If you have C++ 5.5, it was installed from a Sun Studio 8 installation CD (or possibly a copy of such an installation).
As Simon noted, support for template-template parameters was introduced in Sun Studio 10 (C++ 5.7).
You can get the current release, Sun Studio 11 (C++ 5.8) and use it for free. Download it here:
http://developers.sun.com/sunstudio/