This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Specialization of template member function of template class


Hi,

I want to specialize a template member function of a template class.

template<class T>
struct B {

 template< unsigned int Nums>
 void func();
};


template<class T> template< unsigned int Nums> void B<T>::func() {

 // do sth. useful
}

template<class T>
template<>
void
class B<T>::func<3>() {

 // do sth. else
}

Under Windows, the .NET 2003 C++ compiler accepts the code but the gcc 3.4.0 rejects it with the following error:

main.cpp:45: error: invalid explicit specialization before '>' token
main.cpp:45: error: enclosing class templates are not explicitly specialized
main.cpp:47: error: expected identifier before '(' token
main.cpp:47: error: expected unqualified-id before ')' token
main.cpp:47: error: expected `;' before '{' token

Is this an issue of the gcc compiler or is the .NET compiler not C++ standard compliant in this case?

Regards,
Christian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]