This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/49440] New: Invalid dynamic_cast for unnamed namespace
- From: "hordi at ukr dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 16 Jun 2011 13:18:49 +0000
- Subject: [Bug c++/49440] New: Invalid dynamic_cast for unnamed namespace
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49440
Summary: Invalid dynamic_cast for unnamed namespace
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hordi@ukr.net
We have a base class, from this base class we are creating two classes in
unnamed namespace (each class in different *.cpp-file). After that we are
creating one from it and trying to dynamic_cast to other - in result this
operation is processed but should not. This code works properly for gcc-4.4.5
for example...
small description:
file: a.h
class Module{...}
Module *gp = 0;
file a.cpp
namespace
{
class ItemModule : public Module{}
}
some code:
gp = new ItemModule();
file main.cpp
namespace
{
class ItemModule : public Module{}
}
int main()
{
ItemModule *p = dynamic_cast<ItemModule*>(gp);
//I expect to see NULL, but have real address
printf("%p\n",p);
}