public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/6372: private inheritance makes class totally inaccessible, even as parameter
@ 2002-04-19  9:16 Gwenole Beauchesne
  0 siblings, 0 replies; 3+ messages in thread
From: Gwenole Beauchesne @ 2002-04-19  9:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR c++/6372; it has been noted by GNATS.

From: Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
To: david@mandrakesoft.com
Cc: gcc-gnats@gcc.gnu.org, <nobody@gcc.gnu.org>, <gcc-prs@gcc.gnu.org>,
        <gcc-bugs@gcc.gnu.org>, <gdr@codesourcery.com>
Subject: Re: c++/6372: private inheritance makes class totally inaccessible,
 even as parameter
Date: Fri, 19 Apr 2002 18:10:31 +0200 (CEST)

 Hi,
 
 > class A { };
 > class B : private A { };
 > class C : public B {
 > public:
 >     C(A*){}
 > };
 
 This looks inccorect according to 11.1 [#3] + DR #175.
 
 <--- part of DR 175 --->
 Proposed resolution (04/01):
 
 Add to the end of 11.1  class.access.spec paragraph 3:
 
 [Note: In a derived class, the lookup of a base class name will find the 
 injected-class-name instead of the name of the base class in the scope in 
 which it was declared. The injected-class-name might be less accessible 
 than the name of the base class in the scope in which it was declared.] 
 [Example:
 
 class A { };
     class B : private A { };
     class C : public B {
         A* p;    // error: injected-class-name A is inaccessible
         ::A* q;  // OK
     };
 
 --end example]
 
 What do you think Gaby?
 
 


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

* Re: c++/6372: private inheritance makes class totally inaccessible, even as parameter
@ 2002-09-15  5:16 nathan
  0 siblings, 0 replies; 3+ messages in thread
From: nathan @ 2002-09-15  5:16 UTC (permalink / raw)
  To: david, gbeauchesne, gcc-bugs, gcc-prs, nobody

Synopsis: private inheritance makes class totally inaccessible, even as parameter

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Sun Sep 15 05:16:48 2002
State-Changed-Why:
    not a bug. name lookup will find the implicit decl of A in
    A's scope, which is inaccessible from C.
    you should write
      C(::A*){}

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6372


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

* c++/6372: private inheritance makes class totally inaccessible, even as parameter
@ 2002-04-19  6:06 david
  0 siblings, 0 replies; 3+ messages in thread
From: david @ 2002-04-19  6:06 UTC (permalink / raw)
  To: gcc-gnats; +Cc: gbeauchesne


>Number:         6372
>Category:       c++
>Synopsis:       private inheritance makes class totally inaccessible, even as parameter
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 19 06:06:03 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     David Faure
>Release:        gcc-3.1 20020415 (prerelease) - same with "gcc-2.96"
>Organization:
>Environment:
Mandrake Linux 8.2 (also happens on SuSE), i686
>Description:
If B inherits privately from A, then a class inheriting from C cannot use A - not even as a parameter!

(see source code below)

g++ -c a.cc will error, saying:
/tmp/a.cc: In method `C::C (A *)':
/tmp/a.cc:1: `class A' is inaccessible
/tmp/a.cc:5: within this context

Works with gcc-2.95.x, and with SunCC.
>How-To-Repeat:
class A { };
class B : private A { };
class C : public B {
public:
    C(A*){}
};
>Fix:
There's no known fix, when the private inheritance cannot be changed into "public".
>Release-Note:
>Audit-Trail:
>Unformatted:


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

end of thread, other threads:[~2002-09-15 12:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-19  9:16 c++/6372: private inheritance makes class totally inaccessible, even as parameter Gwenole Beauchesne
  -- strict thread matches above, loose matches on Subject: below --
2002-09-15  5:16 nathan
2002-04-19  6:06 david

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