From: Alex Blekhman on
Hello,

Some time ago I asked a question about taking an address of protected
member function:

"C2248: cannot access protected member"
http://groups.google.com/group/microsoft.public.vc.language/browse_frm/thread/a6b6afdca3ea91a2/

Recently I discovered that proposed solution fails to compile with
VC++2008 if the classes are nested and member function is referenced via
fully qualified name:

class Outer
{
class X;
class Y;
};

class Outer::X
{
protected:
void foo() {}
int a;
};

class Outer::Y : public Outer::X
{
public:
void bar()
{
void (Outer::Y::*pf)() = &Outer::Y::foo; // C2248
int Outer::Y::*pa = &Outer::Y::a; // C2248
}
};

If I omit the `Outer' part, then everything compiles smoothly:

void (Outer::Y::*pf)() = &Y::foo;
int Outer::Y::*pa = &Y::a;

Comeau C++ online test compiles the code either way, so I believe it's a
bug in VC++ 2008.

Before I open a bug report, do I miss something here?

Thanks
Alex
From: Victor Bazarov on
Alex Blekhman wrote:
> Some time ago I asked a question about taking an address of protected
> member function:
> [...]
>
> Comeau C++ online test compiles the code either way, so I believe it's a
> bug in VC++ 2008.
>
> Before I open a bug report, do I miss something here?

The fact that 2010 is almost out the door? Just a thought. Might want
to verify the behaviour and file the bug against that too (or not).

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
From: Alex Blekhman on
"Victor Bazarov" wrote:
> The fact that 2010 is almost out the door? Just a thought.
> Might want to verify the behaviour and file the bug against that
> too (or not).

Good idea. Currently I don't have VS 2010 at hand to check it out.
Could anybody of the readers of this group check the code with
VC++ 2010?

Alex

From: Victor Bazarov on
Alex Blekhman wrote:
> "Victor Bazarov" wrote:
>> The fact that 2010 is almost out the door? Just a thought. Might want
>> to verify the behaviour and file the bug against that too (or not).
>
> Good idea. Currently I don't have VS 2010 at hand to check it out. Could
> anybody of the readers of this group check the code with VC++ 2010?

I'll do it at home tonight if I remember to.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
From: John H. on
On Mar 15, 12:20 pm, "Alex Blekhman" <tkfx.REM...(a)yahoo.com> wrote:
> "Victor Bazarov" wrote:
> Could anybody of the readers of this group check the code with
> VC++ 2010?

I get the same errors in VC++ 2010 RC.
g++ 3.4.4 and 4.3.4 both accept it without error.