rootcint generates uncompilable code if no LinkDef.h "+"

From: Robert W. Hatcher <rhatcher_at_fnal.gov>
Date: Tue, 7 Sep 2010 15:19:47 -0500


Recently with the SVN HEAD of ROOT (on Scientific Linux 4.7 w/ gcc 3.4.3)
rootcint has been generating code that won't compile for classes that have a STL map where the primary key value is an enum.

Attached is a tar.gz file w/ an example drawn from one of two separate projects that has gotten bitten by this. Attempting to compile the dictionary source gives:

_ROOT_DICT_pkg2.cc: In member function `virtual void
myspace::MyClass::Streamer(TBuffer&)':
_ROOT_DICT_pkg2.cc:294: error: cannot convert `const
myspace::MyEnum_t' to `void*' in initialization
_ROOT_DICT_pkg2.cc:294: error: expected `,' or `;' before '=' token
_ROOT_DICT_pkg2.cc:295: error: `ptr_' cannot be used as a function

Unwind the tar.gz file, cd root_rcintmap, and ./makescript.sh to demonstrate this problem.

Adding a "+" to the LinkDef.h line for the class with the map<enum,x> (i.e. MyClass) resolves the problem. I see that some of the documentation on LinkDef.h says:

   Note the "+" after the class name: this enables an essential feature    for rootcint. We would love to make it the default but in some cases    we will break code - so we have to ask you to add that "+" at the end!

Is there some reference for when _not_ to add the "+"? I'd like to sweep through the two projects and add "+" (almost) everywhere but I'd also like to avoid breaking anything that might arise from being overzealous.

-robert

Robert W. Hatcher | rhatcher_at_fnal.gov 630-840-3102 FNAL CD/REX (MINOS) | MS 220, PO Box 500, Batavia IL 60510

Received on Tue Sep 07 2010 - 22:20:04 CEST

This archive was generated by hypermail 2.2.0 : Tue Sep 07 2010 - 23:50:01 CEST