This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/20397] New: g++ rejects valid code with 'is inaccessible' error


Example code:

class A {
};

class B : A {
};

class C : B {
public:
	int c(A *a) { return 7; }
};

int main() { 
	
	A a;
	C c;

	return c.c( &a );
}

Gives the error message:

g++ main.cc
	main.cpp:1: `class A' is inaccessible
	main.cpp:9: within this context

Which is true, but not relevant. C never tries to access A through B.

-- 
           Summary: g++ rejects valid code with 'is inaccessible' error
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: matthew dot whitney at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]