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

Senthil Kumar senthilkumar_ttv at yahoo.com
Thu May 17 01:13:01 PDT 2012


Hello everybody,
 
        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?
 
Regards
Senthil Kumar




More information about the cfe-dev mailing list