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 

struct foo<Tag> inaccessible from here

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





PostPosted: Wed Jul 28, 2004 3:16 pm    Post subject: struct foo<Tag> inaccessible from here Reply with quote



Hi!

I got the following code producing an error which I don't understand:

//some wrapper
template<typename Tag>
struct some {};

//some template struct
template<typename Tag>
struct foo
{
template<typename Other>
struct check
{
//filled by specializations
};
};

//explicitly specialize foo::check
template<typename Tag>
template<typename Other>
struct foo<Tag>::check<some
{
//struct foo<Tag> inaccessible within this context:
typedef foo<Tag> parent;
};

int main()
{
//instantiate template to raise error
foo<int>::check<some::parent p;

return 0;
}

The typedef within the specialization is rejected because the
enclosing type foo<Tag> is not accessible. This error is produced
by gcc 3.3. But I have also a MinGW version 3.2 (I don't know
exactly which version and I can't look it up right now) which
accepts the code. So what's wrong?

Frank


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to top
David B. Held
Guest





PostPosted: Wed Jul 28, 2004 10:15 pm    Post subject: Re: struct foo<Tag> inaccessible from here Reply with quote



Frank Birbacher wrote:
Quote:
[...]
The typedef within the specialization is rejected because the
enclosing type foo<Tag> is not accessible. This error is produced
by gcc 3.3. But I have also a MinGW version 3.2 (I don't know
exactly which version and I can't look it up right now) which
accepts the code. So what's wrong?

Comeau online also accepts the code, so you should file a bug
report, if appropriate.

Dave

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

Back to top
Maxim Yegorushkin
Guest





PostPosted: Thu Jul 29, 2004 10:27 am    Post subject: Re: struct foo<Tag> inaccessible from here Reply with quote



David B. Held <dheld (AT) codelogicconsulting (DOT) com> wrote:

Quote:
Frank Birbacher wrote:
[...]
The typedef within the specialization is rejected because the
enclosing type foo<Tag> is not accessible. This error is produced
by gcc 3.3. But I have also a MinGW version 3.2 (I don't know
exactly which version and I can't look it up right now) which
accepts the code. So what's wrong?

Comeau online also accepts the code, so you should file a bug
report, if appropriate.

Is that ok to specialize an enclosed template without fully specializing the enclosing one?

--
Maxim Yegorushkin

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

Back to top
Frank Birbacher
Guest





PostPosted: Fri Jul 30, 2004 2:56 pm    Post subject: Re: struct foo<Tag> inaccessible from here Reply with quote

Hi!

David B. Held wrote:
Quote:
Comeau online also accepts the code, so you should file a bug
report, if appropriate.

I downloaded/compiled/installed gcc 3.4.1 and it accepts the
code, I guess they already fixed it. Strange that mingw 3.2
(which I confirmed now) also accepts the code.

Frank


[ 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.