This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Why is this C++ code incorrect?
- From: "Jiutao Nie" <njt at mprc dot pku dot edu dot cn>
- To: <gcc at gcc dot gnu dot org>
- Date: Tue, 20 Dec 2005 18:18:25 +0800
- Subject: Why is this C++ code incorrect?
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;
}