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++ / December 2004

Tip: Looking for answers? Try searching our database.

limited to a single anonymous class

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Christopher Bohn - 17 Dec 2004 17:25 GMT
It looks like the c++ source for a single object file can not contain
more than one anonymous class that derives from a base class.  When I
attempted to do this, the linker failed with the following error:

fatal error LNK1179: invalid or corrupt file: duplicate COMDAT
'??0__unnamed@@QAE@XZ'

The "??0__unnamed@@QAE@XZ" symbol undecorates to "public: __thiscall
__unnamed::__unnamed(void)" so I think the compiler is using the same
class name for each anonymous class.  When the compiler then synthesizes
a default constructor for each class, it winds up generating two
functions with the same name.

Here is some example code:

#include <exception>

class : public exception
{
} anonymous1;

class : public exception
{
} anonymous2;

This was easy to work around by giving each previously anonymous class a
name but shouldn't the compiler generate unique class names for them?
Vladimir Nesterovsky - 17 Dec 2004 19:31 GMT
> It looks like the c++ source for a single object file can not contain
> more than one anonymous class that derives from a base class.  When I
[quoted text clipped - 23 lines]
> This was easy to work around by giving each previously anonymous class a
> name but shouldn't the compiler generate unique class names for them?

AFAIK C++ standard only talks about anonymous unions, but not classes and
structures.
Do not expect it's compatible code.
--
Vladimir Nesterovsky
e-mail: vladimir@nesterovsky-bros.com
home: http://www.nesterovsky-bros.com
Carl Daniel [VC++ MVP] - 17 Dec 2004 19:42 GMT
> "Christopher Bohn" <cbohn@nospammingrrinc.com> wrote in message
>> This was easy to work around by giving each previously anonymous
[quoted text clipped - 4 lines]
> and structures.
> Do not expect it's compatible code.

Actually, it's legal C++ (unfortunately, IMO).  Sounds like a legit (if
obscure and unimportant) bug to me.

-cd
Ronald Laeremans [MSFT] - 17 Dec 2004 20:29 GMT
It would be easiest if someone could enter an issue on the feedback center
for this.

http://lab.msdn.microsoft.com/productfeedback/default.aspx

This isn't one I have high confidence in we will fix for Whidbey however.

Ronald Laeremans
Visual C++ team

>> "Christopher Bohn" <cbohn@nospammingrrinc.com> wrote in message
>>> This was easy to work around by giving each previously anonymous
[quoted text clipped - 9 lines]
>
> -cd
Christopher Bohn - 21 Dec 2004 16:40 GMT
We are using Visual Studio .NET 2003.  That doesn't seem to be an option
for a product when filing a bug at the site given below.  Is there a way
to file the bug against 2003 or should it be filed under some other
version (even though we haven't tried it under other versions and don't
intend to try the betas from our MSDN subscription)?

> It would be easiest if someone could enter an issue on the feedback center
> for this.
[quoted text clipped - 20 lines]
>>
>>-cd
Ronald Laeremans [MSFT] - 21 Dec 2004 23:04 GMT
Hi Christopher,

If you want a fix in 2003 you need to call product support.

If you want it fixed in a future version you can add an entry at that site.
I would be helpful if you can validate it against the Beta of VC 2005, but
not absolutely required. You can mention it in the entry and ask someone to
repro it on VS 2005.

Thanks.

Ronald

> We are using Visual Studio .NET 2003.  That doesn't seem to be an option
> for a product when filing a bug at the site given below.  Is there a way
[quoted text clipped - 26 lines]
>>>
>>>-cd
Christopher Bohn - 29 Dec 2004 15:45 GMT
The bug report was made:

http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=d557e
a8c-9369-4d11-802b-724b015088ca


thanks

> Hi Christopher,
>
[quoted text clipped - 8 lines]
>
> Ronald

Rate this thread:







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.