Re: Bad CINT dictionary for class with THashTable data member

From: Rene Brun (Rene.Brun@cern.ch)
Date: Fri Dec 17 1999 - 22:49:35 MET


Hi Nick
This problem has been answered a few times by Fons, eg
http://root.cern.ch/cgi-bin/print_hit_bold.pl/root/roottalk/roottalk98/0142.html?TCollection#first_hit

since recently (last two releases) the copy ctor of the
TCollection base class has been made private. This to prevent
unexpected behaviour in case people pass (by accident or ignorance)
a collection by value or embed them in classes without implementing
a proper copy ctor. What happens in the case below is that rootcint
generates always a default copy ctor in case there is not one
defined in the class. A default copy ctor tries to call the copy
ctor of all embedded objects, so also of the TList. However, the TList
has no public copy ctor so you get a compile error. To prevent
this just add a empty copy ctor to the class (so rootcint will
not generate one) and things work fine. 

Rene Brun

On Fri, 17 Dec 1999, Nick West wrote:

> Hi,
> 
> can anyone see what I am doing wrong?  I am running:-
> 
>     ROOT 2.23/08   on  Digital UNIX V4.0F  
> 
> My problem is that if I include a THashTable in my class, Cint generates 
> dictionary code that fails to compile:-
> 
> > Generating TestCint dictionary ...
> > rootcint -f TestCint.cc -c                              \
> >                   Test.h                                        \
> >         LinkDef.h
> > Note: operator new() masked 1c
> > Note: operator delete() masked 1c
> > class Test in Test.h line 3 original base of virtual func
> 
> > cxx -c -o TestCint.o -O -oldcxx -nostdnew -D__osf__ -D__alpha 
> > -I/minosdisk/software/root_2.23_08/root/include -I/usr/include/cxx  TestCint.cc
> 
> > cxx: Error: TestCint.cc, line 130: In this statement, "(*(Test ...)G__int(libp->
> > para[0]))" supplies 1 argument, but 0 are expected.
> >    p=new Test(*(Test*)G__int(libp->para[0]));
> > -----^
> 
> I only have two files: Test.h and Test.cxx:-
> 
> Test.h
> ------
> 
> #include "test/Test.h"
> ClassImp(Test)
> Test::Test() {}
> 
> Test.cxx
> --------
> 
> #include "THashTable.h"
> class Test
> {
> public:
>       Test();
> private:
>       THashTable fRshipTable;
> ClassDef(Test,0)
> };
> 
> If I use a pointer to THashTable then it works so this must involve the
> THashTable constructor somehow.  However class has a default constructor and in
> any case, placing an explicit THashTable in the initialiser list for Test:-
> 
> Test::Test() : fRshipTable(1,2) {}
> 
> doesn't fix the problem.
> 
> Thanks
> 
> Nick West
> 



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:43:44 MET