Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / May 2004

Tip: Looking for answers? Try searching our database.

Bug: specialization of static member variables not supported ion VC7.1

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arne Adams - 01 May 2004 09:50 GMT
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.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.