[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

Gentoo Linux x86_64

Attachments: File objclones.tar.gz    


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.


Comment by Philippe Canal [ 10/Nov/14 ]


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.


Comment by Philippe Canal [ 10/Nov/14 ]

Hi Olivier,

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


Generated at Mon Feb 24 16:08:38 CET 2020 using Jira 8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b.