[cfe-dev] c++ class private member access issue

John McCall rjmccall at apple.com
Thu May 17 15:38:41 PDT 2012


On May 17, 2012, at 1:13 AM, Senthil Kumar wrote:
>         I found a c++ test case like below compiles fine in clang but fails in g++. This is a test case extracted from g++ test suite "gcc-testsuite/src/g++.dg/parse/access3.C". As per deja gnu comments seen in access3.C compilation should fail. Test case is shown below
>  
> class A {
> private:
>   void f();
> };
> class B {
>   friend void A::f();
> };
> 
> clang compilation "clang++ -c access3.C" produces no error
>  
> g++ compilation "g++ -c access3.C"
> access3.C:9: error: ‘void A::f()’ is private
> access3.C:13: error: within this context
> 
> I have checked this error on svn head version, checkout done on 14 May 2012. Is this a known issue?

Yes, it's PR12328.

John.





More information about the cfe-dev mailing list