Why is this C++ code incorrect?

Nathan Sidwell nathan@codesourcery.com
Tue Dec 20 15:37:00 GMT 2005


Jiutao Nie wrote:
> 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?

5.3.4 paras 8, 17 and 18 say so.

nathan
-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



More information about the Gcc mailing list