You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Creating a branch in TTree with type std::vector<A> raises an internal error in ROOT, when class A inherits from a class that uses the old I/O system.
Expected behavior
Branch should be created successfully (I don't know if this behavior is supposed to be supported) or ROOT should abort with a more descriptive error message.
To Reproduce
Compile and run the following macro with root -l -b -q T.C+:
#include<vector>
#include"TTree.h"
#pragma link C++ class A;
#pragma link C++ class B+;
#pragma link C++ class std::vector<B>+;
structA {
int x;
ClassDef(A, 1);
};
ClassImp(A);
structB : A {
int y;
ClassDef(B, 1);
};
ClassImp(B);
voidT() {
TTree* tree = newTTree("T", "T");
std::vector<B> bvec;
tree->Branch("B", &bvec);
}
Macro aborts with the error: Fatal in <TBranchElement::InitializeOffsets>: Could not find the real data member 'B' when constructing the branch 'B' [Likely an internal error, please report to the developers].
fweig
changed the title
TTree: Creating a branch with std::vector can raise an internal error.
TTree: Creating a branch with std::vector can raise an internal error when mixing I/O systems.
Mar 25, 2022
I discovered this by accident when working on CbmRoot. Basically I created a branch with the setup from the reproducer and was greeted with that error message. The base class in that case is pretty old code. I assume nobody ever bothered to update the link def and that's why the '+' was missing in the first place. However it took me some time to figure out that this was the problem and caused quite a bit of headache. That's why I wrote it would be nice if Root would abort with a better error message here. Becomes trivial to fix then.
Describe the bug
Creating a branch in
TTree
with typestd::vector<A>
raises an internal error in ROOT, when classA
inherits from a class that uses the old I/O system.Expected behavior
Branch should be created successfully (I don't know if this behavior is supposed to be supported) or ROOT should abort with a more descriptive error message.
To Reproduce
Compile and run the following macro with
root -l -b -q T.C+
:Macro aborts with the error:
Fatal in <TBranchElement::InitializeOffsets>: Could not find the real data member 'B' when constructing the branch 'B' [Likely an internal error, please report to the developers].
Setup
Additional context
None.
The text was updated successfully, but these errors were encountered: