public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16147] New: dynamic_cast fails to enforce accesssibility
@ 2004-06-22 22:58 gdr at gcc dot gnu dot org
  2004-06-23 13:19 ` [Bug c++/16147] " bangerth at dealii dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gdr at gcc dot gnu dot org @ 2004-06-22 22:58 UTC (permalink / raw)
  To: gcc-bugs

Consider the following program

#include <assert.h>

struct A { virtual ~A() { } };

struct B : A { };

A* f() {
   struct C : private B {

      A* g() { return this; }
   };

   return (new C)->g();
}

int main()
{
   assert(dynamic_cast<B*>(f()) == 0);
}


According to 5.2.7/8, I believe the assert should pass.
I'm seeing this behaviour on GCC-3.3.x and probably before that too.

-- 
           Summary: dynamic_cast fails to enforce accesssibility
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gdr at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: plateform independent


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16147


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

end of thread, other threads:[~2004-08-29 20:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-22 22:58 [Bug c++/16147] New: dynamic_cast fails to enforce accesssibility gdr at gcc dot gnu dot org
2004-06-23 13:19 ` [Bug c++/16147] " bangerth at dealii dot org
2004-08-29 15:17 ` gdr at gcc dot gnu dot org
2004-08-29 16:46 ` nathan at gcc dot gnu dot org
2004-08-29 20:22 ` gdr at integrable-solutions dot net
2004-08-29 20:31 ` gdr at gcc dot gnu dot org
2004-08-29 20:34 ` gdr at gcc dot gnu dot 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).