This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15531] New: dynamic_cast fails (at runtime) when dependant on friendship of invoker
- From: "gccbugs at contacts dot eelis dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 18 May 2004 23:20:16 -0000
- Subject: [Bug c++/15531] New: dynamic_cast fails (at runtime) when dependant on friendship of invoker
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider the following snippet:
struct Base
{
virtual ~Base () {}
};
class Derived : Base
{
friend int main ();
};
#include <cassert>
int main ()
{
Base * p = new Derived;
assert(dynamic_cast<Derived *>(p)); // fails
}
When Derived is changed to publically inherit Base, the dynamic_cast succeeds.
--
Summary: dynamic_cast fails (at runtime) when dependant on
friendship of invoker
Product: gcc
Version: 3.2.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gccbugs at contacts dot eelis dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i486-slackware-linux
GCC target triplet: i486-slackware-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15531