Re: Overridden private method is not hidden in ACLiC

From: Philippe Canal <pcanal_at_fnal.gov>
Date: Tue, 10 Apr 2012 11:25:17 -0500


 > Is this a limitation or feature of ACLiC? Is it possible to make B::Foo private with ACLiC?

It is a current limitation of ACLiC due to the current dictionary implementation. There is no easy way to keep the method private within ACLiC.

Cheers,
Philippe.

On 4/10/12 5:13 AM, OKUMURA, Akira wrote:
> Hello ROOTers,
>
> When I run the main function in the attached C++ code with clang++, g++, ACLiC, or CINT, the behavior is different in ACLiC. I expected that ACLiC could not compile the code because the overridden method Foo is private. But I could call B::Foo without any error or warning.
>
> Is this a limitation or feature of ACLiC? Is it possible to make B::Foo private with ACLiC?
>
> I am using ROOT 5.32/00 on OS X 10.7.3.
>
> === clang++ ===
> $ clang++ test.cxx
> test.cxx:22:5: error: 'Foo' is a private member of 'B'
> b.Foo();
> ^
> test.cxx:13:8: note: declared private here
> void Foo() const {std::cout<< "B::Foo"<< std::endl;}
> ^
> 1 error generated.
>
> === g++ ===
> $ g++ test.cxx
> test.cxx: In function ‘int main()’:
> test.cxx:13: error: ‘void B::Foo() const’ is private
> test.cxx:22: error: within this context
>
> === CINT ===
> $ root
> root [0] .L test.cxx
> root [1] main()
> A::Foo
> Error: can not call private or protected function test.cxx:22:
> test.cxx 13 void B::Foo();
> Calling : B::Foo();
> Match rank: file line signature
> * 1 test.cxx 13 void B::Foo();
> *** Interpreter error recovered ***
>
> === ACLiC ===
> $ root
> root [0] .L test.cxx++
> Info in<ACLiC>: unmodified script has already been compiled and loaded
> Info in<ACLiC>: it will be regenerated and reloaded!
> Info in<TUnixSystem::ACLiC>: creating shared library /Users/oxon/./test_cxx.so
> clang: warning: argument unused during compilation: '-fopenmp'
> root [1] main()
> A::Foo
> B::Foo
> (int)0
>
> --
> OKUMURA, Akira oxon_at_mac.com, okumura_at_stelab.nagoya-u.ac.jp
> Solar-Terrestrial Environment Laboratory, Nagoya University
> Furo-cho, Chikusa-ku, Nagoya 464-8601, Japan
> TEL: +81 52-789-4320 FAX: +81 52-789-4313
> Skype : okumura.akira
Received on Tue Apr 10 2012 - 18:25:25 CEST

This archive was generated by hypermail 2.2.0 : Wed Apr 11 2012 - 11:50:02 CEST