public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49440] New: Invalid dynamic_cast for unnamed namespace
@ 2011-06-16 13:19 hordi at ukr dot net
  2011-06-16 13:22 ` [Bug c++/49440] " hordi at ukr dot net
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: hordi at ukr dot net @ 2011-06-16 13:19 UTC (permalink / raw)
  To: gcc-bugs

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);
}


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-06-27 20:19 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-16 13:19 [Bug c++/49440] New: Invalid dynamic_cast for unnamed namespace hordi at ukr dot net
2011-06-16 13:22 ` [Bug c++/49440] " hordi at ukr dot net
2011-06-16 13:24 ` hordi at ukr dot net
2011-06-22 21:01 ` [Bug c++/49440] [4.5/4.6/4.7 regression] " jason at gcc dot gnu.org
2011-06-23 16:56 ` jason at gcc dot gnu.org
2011-06-27  1:13 ` jason at gcc dot gnu.org
2011-06-27  1:15 ` [Bug c++/49440] [4.6 " jason at gcc dot gnu.org
2011-06-27 20:17 ` jason at gcc dot gnu.org
2011-06-27 20:19 ` jason at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).