Compilation of following code fails with error:

a.cpp: In constructor `c::c()':
a.cpp:14: error: reference to `i' is ambiguous
a.cpp:8: error: candidates are: int b::i
a.cpp:3: error:                 int a::i
a.cpp:14: error: `i' was not declared in this scope

class a{
    private:
        int i;
};

class b{
    public:
        int i;
};

class c: public a,public b{
public:
    c(){
        i=0;
    };
};

int main(){
    c o;
};

a::i isn't accessible in constructor of c. 
Reference to i can't be ambiguous.


-- 
           Summary: private isn't private
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: wbrana at gmail dot com


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

Reply via email to