Re: (root)CINT parsing problem

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Tue Oct 19 1999 - 16:19:58 MEST


Can you change for the time being the header of this class to be:

#ifndef __CINT__
class SubClass;
#endif

in the meanwhile a fix should be available shortly.

Cheers, Fons.




Rutger van der Eijk wrote:
> 
> Hi,
> 
> Consider the following lines of code:
> 
> ----------------
> class SubClass;
> 
> class TopClass {
> public:
>   TopClass() { }
>   ~TopClass() { }
> 
>   class SubClass {
>   public:
>     inline SubClass();
>     ~SubClass() { }
>   };
> 
>   inline SubClass getSubClass();
> };
> 
> inline TopClass::SubClass::
> SubClass()
> {
> }
> 
> inline TopClass::SubClass TopClass::getSubClass() {
>   return SubClass();
> }
> -----------------
> 
> Running rootcint on this produces the output:
> 
> Error: class,struct,union or type TopClass::SubClass not defined
> FILE:./include/TopClass.H LINE:30
> Error: class,struct,union or type TopClass::SubClassTopClass not defined
> FILE:./include/TopClass.H LINE:36
> Warning: Error occured during reading source files
> Note: operator new() masked 1c
> Note: operator delete() masked 1c
> Warning: Error occured during dictionary source generation
> Error loading headers...
> gmake: *** [../dict/dictRootTest.C] Error 1
> 
> i.e. rootcint has problems parsing this and terminates. If you now remove
> the forward declaration
> 
> class SubClass;
> 
> in the beginning it runs without problems. This looks to me like some
> parsing error of (root)CINT...
> 
> Ofcourse in the above example the forward declaration isn't necesarry but
> in the real code (this is only a stripdown of that code to catch essence
> of problem) that gives me this problem it is.
> 
> I'm not able to change the 'real code' to not give this problem because
> it's not my code (it occurs in HepGenMatrix of CLHEP). I don't think it's
> wrong C++ anyway so I think changes should be made on parser.
> 
> This problem results in a failure to generate shared libs for me only now
> I'm moving to roor v2.23. With root v2.22 I also got these error messages
> but rootcint didn't stop and I assumed I could ignore them (with seemed to
> work uit fine). However with v2.23 rootcint stops which so I can not make
> this 'dirty' assumption anymore => i.e. I can't work with v2.23! A
> quick bug fix or (if not possible) a workaround for me would be very
> usefull as I seem not to be able to move to v2.23 like this...
> 
> Thanks,
> 
> Rutger

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland
E-Mail: Fons.Rademakers@cern.ch              Phone: +41 22 7679248
WWW:    http://root.cern.ch/~rdm/            Fax:   +41 22 7677910



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