public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17874] New: Reference to member of protected base should be an error
@ 2004-10-07  0:16 kerch at cup dot hp dot com
  2004-10-07  0:24 ` [Bug c++/17874] " pinskia at gcc dot gnu dot org
  2004-10-07  0:24 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: kerch at cup dot hp dot com @ 2004-10-07  0:16 UTC (permalink / raw)
  To: gcc-bugs

Referencing the member function "l" in the below example should
not be allowed. The friend relationship that "A" has to "C" is
not inherited in "B" (see 11.4 P8).

class A {
public:
    void l();
    friend class C;
};

class B : protected A {
};

class C {
    void v(B * g) { g->l(); }
}; 
class C {
     void v(B * g) {
       g->l();                      // Error -- referencing member in B,
                    // or cast to base and reference in A,
                    // which is the same as the following:
       (static_cast<A *>(g))->l();  // Error -- can't cast to protected base
       ((A *)g)->l();               // Okay -- old-style cast ignores access
       A *p;
       p->l();                      // Okay -- referencing member in A
     }
};

-- 
           Summary: Reference to member of protected base should be an error
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kerch at cup dot hp dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


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

* [Bug c++/17874] Reference to member of protected base should be an error
  2004-10-07  0:16 [Bug c++/17874] New: Reference to member of protected base should be an error kerch at cup dot hp dot com
  2004-10-07  0:24 ` [Bug c++/17874] " pinskia at gcc dot gnu dot org
@ 2004-10-07  0:24 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-07  0:24 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
      Known to fail|                            |4.0.0 3.3 3.0.4
   Last reconfirmed|0000-00-00 00:00:00         |2004-10-07 00:24:37
               date|                            |


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


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

* [Bug c++/17874] Reference to member of protected base should be an error
  2004-10-07  0:16 [Bug c++/17874] New: Reference to member of protected base should be an error kerch at cup dot hp dot com
@ 2004-10-07  0:24 ` pinskia at gcc dot gnu dot org
  2004-10-07  0:24 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-10-07  0:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-10-07 00:24 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2004-10-07 00:24:37         |2004-10-07 00:24:52
               date|                            |


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


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

end of thread, other threads:[~2004-10-07  0:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-07  0:16 [Bug c++/17874] New: Reference to member of protected base should be an error kerch at cup dot hp dot com
2004-10-07  0:24 ` [Bug c++/17874] " pinskia at gcc dot gnu dot org
2004-10-07  0:24 ` pinskia 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).