public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/28444]  New: static_cast allowed, even if only the base class is accessible
@ 2006-07-20 11:55 tim at klingt dot org
  2006-07-20 13:09 ` [Bug c++/28444] " pinskia at gcc dot gnu dot org
  2006-07-22 18:46 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 4+ messages in thread
From: tim at klingt dot org @ 2006-07-20 11:55 UTC (permalink / raw)
  To: gcc-bugs

hi all,

i searched for a similar bug, but i'm not sure, if it has been reported:

the following code compiles fine with gcc, but it shouldn't:

struct foo
{
    friend class caster;
};

struct bar:
    protected foo
{

};

struct caster
{
    foo * cast(bar* b)
    {
        return static_cast<foo*>(b);
    }
};

int main()
{
    bar * b = new bar;
    caster c;
    foo * f = c.cast(b);
}

from my understanding, it should only compile if, caster would be a friend of
bar


-- 
           Summary: static_cast allowed, even if only the base class is
                    accessible
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tim at klingt dot org


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


^ permalink raw reply	[flat|nested] 4+ messages in thread
[parent not found: <bug-28444-4@http.gcc.gnu.org/bugzilla/>]

end of thread, other threads:[~2013-07-06 17:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-20 11:55 [Bug c++/28444] New: static_cast allowed, even if only the base class is accessible tim at klingt dot org
2006-07-20 13:09 ` [Bug c++/28444] " pinskia at gcc dot gnu dot org
2006-07-22 18:46 ` pinskia at gcc dot gnu dot org
     [not found] <bug-28444-4@http.gcc.gnu.org/bugzilla/>
2013-07-06 17:30 ` paolo.carlini at oracle dot com

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).