C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

using declaration for class member template

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated)
View previous topic :: View next topic  
Author Message
Andrew N. Maximov
Guest





PostPosted: Sat Jun 18, 2005 9:25 am    Post subject: using declaration for class member template Reply with quote



Hello, All!

I have a little problem with using declaration...

struct A
{
template <class T>
void foo(T a) { }
};

struct B : private A
{
using A::foo;
};

int main()
{
B b;
b.foo(5);
return 0;
}

[email]dron@hal:~/gcc.bugs[/email]$ g++ templ.using.cxx -c -o templ.using.o
templ.using.cxx: In function `int main()':
templ.using.cxx:4: error: `void A::foo(T) [with T = int]' is inaccessible
templ.using.cxx:15: error: within this context

[email]dron@hal:~/gcc.bugs[/email]$ g++ --version
g++ (GCC) 3.3.3

This is gcc bug, or not?

With best regards, Andrew N. Maximov.
Radius Ltd, +7 0843943236 ICQ:101436920



[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Sumit Rajan
Guest





PostPosted: Sun Jun 19, 2005 11:58 am    Post subject: Re: using declaration for class member template Reply with quote




"Andrew N. Maximov" <MXLUKKPSKWMU (AT) spammotel (DOT) com> wrote

Quote:
Hello, All!

I have a little problem with using declaration...

struct A
{
template <class T
void foo(T a) { }
};

struct B : private A
{
using A::foo;
};

int main()
{
B b;
b.foo(5);
return 0;
}

I do not see why this should not compile. It seems to compile successfully
using Comeau and with VC++ 7.1.
--
Sumit Rajan


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
mlimber
Guest





PostPosted: Tue Jun 21, 2005 6:33 pm    Post subject: Re: using declaration for class member template Reply with quote



Sumit Rajan wrote:
Quote:
I do not see why this should not compile. It seems to compile successfully
using Comeau and with VC++ 7.1.

And with VC++ 6 and g++ 3.4.1.

M


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]


Back to top
Chris Hoge
Guest





PostPosted: Tue Jun 21, 2005 6:35 pm    Post subject: Re: using declaration for class member template Reply with quote

Curious. Using g++ 3.3 and 3.1 it fails, but with g++ 4.0 it compiles.
So it's likely a gcc bug that's been fixed with the latest compiler.


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ Language (Moderated) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.