Uploaded image for project: 'ROOT'
  1. ROOT
  2. ROOT-6787

TObject (the very class "TObject") can not be put into TClonesArray - "TObject does not inherit from TObject"

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: High
    • Resolution: Fixed
    • Affects Version/s: 6.02.00
    • Fix Version/s: 6.04.00, 6.02/02
    • Component/s: None
    • Labels:
      None
    • Environment:

      Gentoo Linux x86_64

      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

        Attachments

          Activity

            People

            • Assignee:
              pcanal Philippe Canal
              Reporter:
              ofreyerm Oliver Freyermuth
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: