Hi,
the following does not compile with VC7.1 (and I think it should according to
the C++ Standard (1998))
template<class T> struct SpecializeStaticMember
{
static int m_Num;
};
// declaration and definition of the general member variable
// (will be 0 initialized because it has static storage duration)
template<class T> int SpecializeStaticMember<T>::m_Num;
// declaration of the special member variable must be visible before
// SpecializeStaticMember<double>::m_Num gets used
template<> int SpecializeStaticMember<double>::m_Num;
// definition of the special member variable must be in
// one and only one translation unit
template<> int SpecializeStaticMember<double>::m_Num = 23.1; /* error C2086
here*/

Signature
Regards,
Arne
Tomas Restrepo \(MVP\) - 01 May 2004 14:42 GMT
Hi Arne,
> Hi,
> the following does not compile with VC7.1 (and I think it should according to
[quoted text clipped - 17 lines]
> template<> int SpecializeStaticMember<double>::m_Num = 23.1; /* error C2086
> here*/
Whidbey gives the same error. Comeau seems to agree with you that it should
work.
I'll but it against whidbey just in case.

Signature
Tomas Restrepo
tomasr@mvps.org
Tian Min Huang - 03 May 2004 06:42 GMT
Hello Arne,
Thanks for your post. Tomas is correct and I am able to reproduce the
problem in Whidbey. The issue has been entered into our database and it is
being investigated. It is possible that this may be resolved in the next
version of VS .NET, but I cannot guarantee a resolution of this issue at
this time.
Have a nice day!
Regards,
HuangTM
Microsoft Online Partner Support
MCSE/MCSD
Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.