Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 8205
Product:  
Component:  
Status: RESOLVED
Resolution: FIXED
Assigned To: Not yet assigned to anyone <unassigned@gcc.gnu.org>
Host:
Reported against  
Priority:  
Severity:  
Target Milestone:  
 
 
Target:
Reporter: hou_zhenyu@hotmail.com
Add CC:
CC:
Remove selected CCs
Build:
URL:
Summary:
Keywords:
Known to work:
Known to fail:

Attachment Description Type Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 8205 depends on: Show dependency tree
Show dependency graph
Bug 8205 blocks:

Additional Comments:






View Bug Activity   |   Format For Printing   |   Clone This Bug


Description:   Last confirmed: Opened: 2002-10-11 20:56
when multiple non-public base classes are used, using declarations for changing
acccessibility of the base classes members have no effect. When access such
members in client code, the compiler reports: 
'Base' is an inaccessible base of 'Heir'

Release:
gcc3.2

Environment:
mingw2.0 release

How-To-Repeat:
class A { public: int i; };

class B {};

class D : A    { public: using A::i; };
class E : A, B { public: using A::i; };

int main()
{
  D d;
  d.i;
  E e;
  e.i; // "`A' is an inaccessible base of `E'"
}

------- Comment #1 From hou_zhenyu@hotmail.com 2002-10-11 20:56 -------
Fix:
None. Change private inheritance to public inheritance can work, but it breaks the semantic.

------- Comment #2 From Wolfgang Bangerth 2002-11-04 14:46 -------
State-Changed-From-To: open->analyzed
State-Changed-Why: Right, this is a regression in 3.2, as it compiled cleanly
    in 2.95.I thus set the priority to "high" and let others
    decide what to do with it.
    
    However, it turns out that this is fixed on the mainline
    again (or the problem was never introduced there). For 
    reference, I append the code in question below.
    
    Regards
      Wolfgang
    
    
    -------------------------
    class A { public: int i; };
    class B {};
    class E : A, B { public: using A::i; };
    
    int main() {
      E e;
      e.i; // "`A' is an inaccessible base of `E'"
    }
    ----------------------------------
    tmp/g> /home/bangerth/bin/gcc-3.2.1-pre/bin/c++ -c x.cc
    x.cc: In function `int main()':
    x.cc:7: `A' is an inaccessible base of `E'
    
    tmp/g> /home/bangerth/bin/gcc-3.3x-pre/bin/c++ -c x.cc

------- Comment #3 From Wolfgang Bangerth 2002-12-13 16:04 -------
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-bugs@gcc.gnu.org
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c++/8205: [3.2 regression] using declaration & mulitiple
 inheritance
Date: Fri, 13 Dec 2002 16:04:50 -0600 (CST)

 Upon closer inspection, I believe that this high priority regression is 
 actually another manifestation of (high priority regression) c++/8117. The 
 testcase for the latter is 
 ---------------------
 struct A { virtual void foo() = 0; };
 
 struct B : A {};
 struct C : A {};
 
 struct D : B, C { virtual void foo() {} };
 
 void (D::* p)() = &D::foo;  // 'A' is an ambiguous base of 'D'
 --------------------
 while for the former
 --------------------
 struct A { int i; };
 struct B {};
 class E : A, B { public: using A::i; };
 
 void foo() { E().i; } // "`A' is an inaccessible base of `E'"
 ---------------------
 
 The theory that they are the same is also supported by the fact that both 
 started to show up somewhere between 2001-11-25 and 2001-12-01.
 
 Regards
   Wolfgang
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth              email:           bangerth@ticam.utexas.edu
                                www: http://www.ticam.utexas.edu/~bangerth
 
 


------- Comment #4 From janis187@us.ibm.com 2002-12-23 09:44 -------
From: Janis Johnson <janis187@us.ibm.com>
To: hou_zhenyu@hotmail.com, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   chicares@mindspring.com, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org
Cc:  
Subject: Re: c++/8205: [3.2 regression] using declaration & mulitiple inheritance
Date: Mon, 23 Dec 2002 09:44:31 -0800

 The regression reported in PR c++/8205 still exists on the
 3.2 branch.  The patch that caused the bug to show up, and
 the patch that caused it to go away on the mainline, are
 shown here.  They are both very large so it's quite likely
 that this information isn't very useful.
 
 Here's the patch that caused the regression to show up:
 
 2001-11-25  Nathan Sidwell  <nathan@codesourcery.com>
 
         PR g++/3145
         * class.c
         * cp-tree.h
         * call.c
         * cvt.c
         * init.c
         * rtti.c
         * search.c
         * typeck.c
         * typeck2.c
 
 Here's the patch that caused it to go away on the mainline:
 
 2002-08-07  Mark Mitchell  <mark@codesourcery.com>
 
         Rework build_component_ref.
         * call.c
         * class.c
         * cp-tree.def
         * cp-tree.h
         * decl.c
         * decl2
         * error.c
         * except.c
         * init.c
         * method.c
         * parse.y
         * pt.c
         * search.c
         * semantics.c
         * spew.c
         * tree.c
         * typeck.c
         * typeck2.c
 
 Here's a small test case that causes the compiler to
 complain about valid code on i686-linux with the 3.2
 branch cc1plus:
 
 -------------------
 class A { public: int i; };
 class B {};
 class E : A, B { public: using A::i; };
 
 int main() {
   E e;
   e.i; // "`A' is an inaccessible base of `E'"
 }
 -------------------
 
 Output from the 3.2 branch compiler:
 
 8205.C: In function `int main()':
 8205.C:7: `A' is an inaccessible base of `E'
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8205
 
 
 

------- Comment #5 From Joe Buck 2003-04-25 21:00 -------
State-Changed-From-To: analyzed->closed
State-Changed-Why: Fixed for 3.3.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug