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++ / October 2005

Tip: Looking for answers? Try searching our database.

VS2005 Compiler bug

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Staffan Langin - 31 Oct 2005 13:01 GMT
Hello,

Is there a workaround for the code-snippet below?

namespace A {
template<class T>
class Foo
{
};
}

template<class T>
class Foo : public A::Foo<T>
{
friend class A::Foo<T>;
};
David Wilkinson - 31 Oct 2005 13:16 GMT
> Hello,
>
[quoted text clipped - 12 lines]
> friend class A::Foo<T>;
> };

This works in VS2003 (at least it compiles):

template<class T>
class Foo : public A::Foo<T>
{
typedef A::Foo<T> AFoo;
friend class Afoo;
};

David Wilkinson
Staffan Langin - 31 Oct 2005 18:56 GMT
> This works in VS2003 (at least it compiles):
>
[quoted text clipped - 6 lines]
>
> David Wilkinson

David,

It seems to work with VS2005 aswell. Thanks!

Best regards,

Staffan Langin
Holger Grund - 31 Oct 2005 13:22 GMT
> Is there a workaround for the code-snippet below?

VC is known to have issue with templates and friends.

> namespace A {
> template<class T>
[quoted text clipped - 7 lines]
> {
> friend class A::Foo<T>;

I've seen VC treat class X in a friend declaration as
a ETS introducing a new type in the innermost containing
namespace scope.

You could try to omit class and it should work for VC++
(but not for other compilers)

-hg
Staffan Langin - 31 Oct 2005 13:41 GMT
> You could try to omit class and it should work for VC++
> (but not for other compilers)

Yes, that seems to work for VS2005. Thanks.

Best regards,

Staffan Langin

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.