c++/8500: Allows cast to private base class
Gabriel Dos Reis
gdr@integrable-solutions.net
Mon Nov 11 04:16:00 GMT 2002
The following reply was made to PR c++/8500; it has been noted by GNATS.
From: Gabriel Dos Reis <gdr@integrable-solutions.net>
To: gcc-gnats@gcc.gnu.org
Cc:
Subject: Re: c++/8500: Allows cast to private base class
Date: 11 Nov 2002 12:36:48 +0100
Wolfgang Bangerth <bangerth@ticam.utexas.edu> writes:
| The following reply was made to PR c++/8500; it has been noted by GNATS.
|
| From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
| To: "Harald H. Soleng" <Harald.Soleng@nr.no>
| Cc: gcc-gnats@gcc.gnu.org
| Subject: Re: c++/8500: Allows cast to private base class
| Date: Fri, 8 Nov 2002 14:03:20 -0600 (CST)
|
| > You should not get an error with old style c-casting.
| > However, with
| >
| > Base* b1 = static_cast<Base*> d1;
| >
| > on the second line of main you should. Here is the error message from
| > the native Sun CC compiler:
| > "Error: Using static_cast to convert from Derived* to Base* not allowed."
|
| Uhm, I don't think you can work around access control rules just by using
| a C-style cast over a static_cast, can you?
old-style casts don't chech acess control. New-style casts do, however.
-- Gaby
More information about the Gcc-prs
mailing list