public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/7309: Cannot create instances of privatly inherited grand-parent classes in a method of a class.
@ 2002-07-14 23:26 gthomas
  0 siblings, 0 replies; 2+ messages in thread
From: gthomas @ 2002-07-14 23:26 UTC (permalink / raw)
  To: gcc-gnats


>Number:         7309
>Category:       c++
>Synopsis:       Cannot create instances of privatly inherited grand-parent classes in a method of a class.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jul 14 23:26:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Gene.Thomas@eServGlobal.com
>Release:        3.0.4
>Organization:
>Environment:
System: HP-UX hp5 B.11.00 A 9000/785 2002388384 two-user license


	
host: hppa2.0w-hp-hpux11.00
build: hppa2.0w-hp-hpux11.00
target: hppa2.0w-hp-hpux11.00
configured with: ../gcc-3.0.4/configure --prefix=/opt/gcc-3.0.4 --enable-shared --with-gnu-as --with-as=/opt/binutils-2.11/bin/as --enable-languages=c,c++ --disable-libgcj
>Description:
	
>How-To-Repeat:
	
 class A {
 
 };
 
 class B : private A {
 public:
    void bf() {
       A a;                      // this is ok
   }
 };
 
 class C : public B {
 public:
    void cf() {
         A a;                    // `class A' is inaccessible COMPILE ERROR
    }
 };
 
 int main() {
     A a;                        // but this is ok
     return 0;
 }

Fix:

void cf() {
    ::A a;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:


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

* Re: c++/7309: Cannot create instances of privatly inherited grand-parent classes in a method of a class.
@ 2002-09-14  5:14 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-09-14  5:14 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, gthomas, nobody

Synopsis: Cannot create instances of privatly inherited grand-parent classes in a method of a class.

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Sat Sep 14 05:14:31 2002
State-Changed-Why:
    not a bug. Name lookup of 'A' finds the artificial decl
    of A inside A via the protected path C->B->A, which is
    indeed inaccessible. C++ forces you to write ::A

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


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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-14 23:26 c++/7309: Cannot create instances of privatly inherited grand-parent classes in a method of a class gthomas
2002-09-14  5:14 nathan

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