| View previous topic :: View next topic |
| Author |
Message |
Frank Birbacher Guest
|
Posted: Wed Jul 28, 2004 3:16 pm Post subject: struct foo<Tag> inaccessible from here |
|
|
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
|
Posted: Wed Jul 28, 2004 10:15 pm Post subject: Re: struct foo<Tag> inaccessible from here |
|
|
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
|
Posted: Thu Jul 29, 2004 10:27 am Post subject: Re: struct foo<Tag> inaccessible from here |
|
|
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
|
Posted: Fri Jul 30, 2004 2:56 pm Post subject: Re: struct foo<Tag> inaccessible from here |
|
|
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 |
|
 |
|