Why is this C++ code incorrect?
Jiutao Nie
njt@mprc.pku.edu.cn
Tue Dec 20 13:08:00 GMT 2005
Hi,
Compiling the following code with g++ will report error:`static void
A::operator delete(void*)' is protected. It's correct If B is derived from
A without "virtual". Why does the "new B" expression need to check the
delete operator's accessibility when B is virutally derived from A?
class A
{
protected:
static void operator delete( void * ) {}
};
class B : public virtual A {};
void f()
{
new B;
}
More information about the Gcc
mailing list