By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,820 Members | 1,187 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,820 IT Pros & Developers. It's quick & easy.

Error : Visual 2005 is more C++ compliant and my projct doesn't compile

P: n/a

Hi,

I found a project called ACF and that implemnts .NET classes into C++.
The issue come from the fact that it was developped under VS 2003
and under 2005 I get the following

c:\acf\src\corlib\acf\acfbase.h(364) : error C2299:
'Acf::RefPtr<T>::RefPtr' : behavior change: an explicit specialization
cannot be a copy constructor or copy assignment operator

template <class T> // T: reference types (object, interface)
class RefPtr
{
// Fields
private:
T* _p;

// Constructor & Destructor
public:
RefPtr() : _p(null)
{
}
RefPtr(T* p) : _p(p)
{
_AddRef();
}
// Templated version to allow pBase = pDerived
template <class U>
RefPtr(const RefPtr<U>& src) : _p((U*)src)
{
_AddRef();
}

// METHOD BELOW DO NOT COMPILE
template <>
RefPtr(const RefPtr<T>& src) : _p((T*)src)
{
_AddRef();
}

~RefPtr()
{
_Release();
}
.....
};
How can I fix that ?
Jun 13 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a

Vincent RICHOMME wrote:
Hi,

I found a project called ACF and that implemnts .NET classes into C++.
The issue come from the fact that it was developped under VS 2003
and under 2005 I get the following

c:\acf\src\corlib\acf\acfbase.h(364) : error C2299:
'Acf::RefPtr<T>::RefPtr' : behavior change: an explicit specialization
cannot be a copy constructor or copy assignment operator

template <class T> // T: reference types (object, interface)
class RefPtr
{
// Fields
private:
T* _p;

// Constructor & Destructor
public:
RefPtr() : _p(null)
{
}
RefPtr(T* p) : _p(p)
{
_AddRef();
}
// Templated version to allow pBase = pDerived
template <class U>
RefPtr(const RefPtr<U>& src) : _p((U*)src)
{
_AddRef();
}

// METHOD BELOW DO NOT COMPILE
template <>
RefPtr(const RefPtr<T>& src) : _p((T*)src)
Try just this (no "template<>"):

RefPtr(const RefPtr& src) : _p((T*)src)

{
_AddRef();
}

~RefPtr()
{
_Release();
}
....
};
How can I fix that ?


Cheers! --M

Jun 13 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.