Access issues

0 views
Skip to first unread message

wasti...@gmx.net

unread,
Feb 2, 2008, 3:09:02 AM2/2/08
to
Hi,

Given:

class outer
{
class inner
{
};

public:
typedef inner expose;
};


Should this code work?

int main()
{
outer::expose e;
}


How about this?

class derived : public outer::expose
{
};


OK, last one:

class derived : public outer::expose
{
typedef outer::expose base_type;
};

I think all of them should work. GCC accepts all of them. However,
MSVC 7.1 rejects the last one, and I'm not quite sure if there might
be some weird rule it could follow.

Also, if this is an MSVC bug, could those of you with higher versions
tell me if and when it was fixed?

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

Daniel Krügler

unread,
Feb 3, 2008, 11:15:56 AM2/3/08
to
On 2 Feb., 09:09, wasti.r...@gmx.net wrote:
> Given:
>
> class outer
> {
> class inner
> {
> };
>
> public:
> typedef inner expose;
>
> };
>
> Should this code work?
>
> int main()
> {
> outer::expose e;
>
> }
>
> How about this?
>
> class derived : public outer::expose
> {
>
> };
>
> OK, last one:
>
> class derived : public outer::expose
> {
> typedef outer::expose base_type;
>
> };
>
> I think all of them should work.

I agree with you, that all three examples should
work according to the standard.

> GCC accepts all of them. However,
> MSVC 7.1 rejects the last one, and I'm not quite sure if there might
> be some weird rule it could follow.
>
> Also, if this is an MSVC bug, could those of you with higher versions
> tell me if and when it was fixed?

I'm quite sure that this is an MSVC 7.1
bug, because case 3 is not essentially
different from the other ones. At least
MSVC 8 SP1 has no problems with your
example.

HTH & Greetings from Bremen,

Daniel Krügler

Reply all
Reply to author
Forward
0 new messages