Vc++ 8.0
IDE:Visual C++ 8.0
version:2.1.2
Symptom: Compile Error(C2299) in handle.h
handle.h
Code:
#ifdef _WIN32 // COMPILERBUG: Is VC++ or GNU C++ right here???
template<>
Handle(const Handle<T>& r) // C2299
#else
Handle(const Handle& r)
#endif
{
this->_ptr = r._ptr;
if(this->_ptr)
{
this->_ptr->__incRef();
}
error C2299: 'IceUtil::Handle<T>::Handle' :
behavior change: an explicit specialization cannot be a copy constructor or copy assignment operator
d:\program files\开发环境\ice2.1.2\include\iceutil\handle.h 141
some information I found in MSDN:
"This error can also be generated as a result of compiler conformance work that was done for Visual C++ 2005: previous versions of Visual C++ allowed explicit specializations for a copy constructor or a copy assignment operator.
To resolve C2299, do not make the copy constructor or assignment operator a template function, but rather a non-template function that takes a class type. Any code that calls the copy constructor or assignment operator by explicitly specifying the template arguments needs to remove the template arguments."
And more:
"Breaking Changes in the Visual C++ 2005 Compiler
Explicit specialization not allowed as a copy constructor/copy assignment operator
Code that depends on an explicit template specialization for a copy constructor or copy assignment operator will now get Compiler Error C2299. Standard C++ prohibits this. This change was made for conformance reasons, to make code more portable.
"
Li Delong
Student, Beijing Jiaotong University.
Currently working on a experimental online game project.