Hello I tried this with cint5.14.36, the latest version, it works fine. Probably, certain version of cint had this problem. That is cint wrongly execises derived to base class conversion with copy constructor. I thought this was a side effect of some other fix and the side effect is fixed now. Thank you Masaharu Goto >Hi, > >I have a problem with copy ctor and RootCint. To illustrate the problem >please see the macro below. It works fine when compiled. Could you >please > explain this behavior ? Am I doing something wrong ? > >Regards, > > >------------- > >#ifndef __CINT__ >#include <cstdio> >#endif > >class A { >public: > A() { } > A(const A& a) { printf("oups...\n") ; } > virtual ~A() { } >} ; > >class B : public A { >public: > B() { } > virtual ~B() { } >} ; > >class C { >public: > C() { } > ~C() { } > void test(const A& a) { printf("OK\n") ; } >} ; > >void RootCopy(void) >{ > A a ; > B b ; > C c ; > > // should produce "OK" > c.test(a) ; > // should also produce "OK" but produces "oups... OK" > c.test(b) ; >} > >#ifndef __CINT__ > >int main(void) >{ > RootCopy() ; > >} > >#endif >-- >Dr. Laurent APHECETCHE (mailto:aphecetc@in2p3.fr) | TAPS/PHENIX/ALICE >SUBATECH-Ecole des Mines de Nantes-4 rue Alfred Kastler-44070 NANTES >cedex 03 >TEL (+33/0) 2 51 85 84 17 - FAX (+33/0) 2 51 85 84 24 (France) >http://www-subatech.in2p3.fr/~photons - >http://www.phenix.bnl.gov/~aphecetc
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:24 MET