Alex Blekhman
2010-03-15 10:37:30 UTC
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
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