This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: c++/8500: Allows cast to private base class
- From: bangerth at dealii dot org
- To: Harald dot Soleng at nr dot no, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 8 Nov 2002 14:58:54 -0000
- Subject: Re: c++/8500: Allows cast to private base class
- Reply-to: bangerth at dealii dot org, Harald dot Soleng at nr dot no, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: Allows cast to private base class
State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Fri Nov 8 06:58:52 2002
State-Changed-Why:
Confirmed. Reduced code looks like this:
------------------------------
class Base {};
class Derived : private Base {
public:
Derived () : Base() {}
};
int main(void) {
Derived* d1 = new Derived;
Base* b1 = (Base*) d1;
}
----------------------------------
Note that we get indeed an error if the cast (Base*) is
removed, but not with it.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8500