[ROOT-6787] TObject (the very class "TObject") can not be put into TClonesArray - "TObject does not inherit from TObject" Created: 04/Oct/14  Updated: 10/Nov/14  Resolved: 10/Nov/14

Status: Closed
Project: ROOT
Component/s: None
Affects Version/s: 6.02.00
Fix Version/s: 6.04.00, 6.02/02

Type: Bug Priority: High
Reporter: Oliver Freyermuth Assignee: Philippe Canal
Resolution: Fixed Votes: 0
Labels: None
Environment:

Gentoo Linux x86_64


Attachments: File objclones.tar.gz    
Development:

 Description   

Dear ROOTers,

with ROOT 6 as of heads/master@v6-00-01-1371-gebfed89, I build the following simple program:

 
#include "TClass.h"
#include "TClonesArray.h"
#include "TObject.h"
 
int main(int argc, char** argv) {
        TClonesArray clArray(TObject::Class(), 100);
        new (clArray[0]) TObject();
        return 0;
}

Running it, I get:

Error in <TClonesArray::SetClass>: TObject does not inherit from TObject
 
 *** Break *** segmentation violation

Of course I agree one rarely wants to put TObject (instead of something inheriting from it) into a TClonesArray (I just wanted to do that to test another issue), still, it worked in ROOT 5 and the error message is a bit irritating .

For convenience, I have attached the code + simple makefile in a tarfile.

Cheers,
Oliver



 Comments   
Comment by Philippe Canal [ 10/Nov/14 ]

Hi,

The is an order of initialization problem (I am tracking it down), in the meantime adding:

   TApplication thapp("something",argc,argv);

as the first statement of main solves the problem.

Cheers,
Philippe.

Comment by Philippe Canal [ 10/Nov/14 ]

Hi Olivier,

The underlying problem has been fixed in the master and v6.02 patch branch.

Thanks,
Philippe.

Generated at Sat Sep 21 06:39:15 CEST 2019 using Jira 7.13.1#713001-sha1:5e06076c2d215a6f699b7e5c90ab2fae7ba5a1ce.