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

* [Bug c++/28444] static_cast allowed, even if only the base class is accessible
  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 ` pinskia at gcc dot gnu dot org
  2006-07-22 18:46 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-20 13:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-07-20 13:09 -------
Related to PR 17874, maybe even a dup of that bug.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |17874


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


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

* [Bug c++/28444] static_cast allowed, even if only the base class is accessible
  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
  1 sibling, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-07-22 18:46 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2006-07-22 18:46 -------
Yes this is a dup of bug 17874.

*** This bug has been marked as a duplicate of 17874 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


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


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

* [Bug c++/28444] static_cast allowed, even if only the base class is accessible
       [not found] <bug-28444-4@http.gcc.gnu.org/bugzilla/>
@ 2013-07-06 17:30 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 4+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-07-06 17:30 UTC (permalink / raw)
  To: gcc-bugs

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

Bug 28444 depends on bug 17874, which changed state.

Bug 17874 Summary: Reference to member of protected base should be an error
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17874

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED


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

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