Description
RClassField::Attach only takes into account persistent members to determine alignment:
|
void ROOT::Experimental::RClassField::Attach(std::unique_ptr<RFieldBase> child, RSubFieldInfo info) |
|
{ |
|
fMaxAlignment = std::max(fMaxAlignment, child->GetAlignment()); |
|
fSubFieldsInfo.push_back(info); |
|
RFieldBase::Attach(std::move(child)); |
|
} |
Reproducer
#include <ROOT/RField.hxx>
class ClassWithTransient {
char a;
int t; //!
char b;
};
void ntuple_class_align() {
ROOT::Experimental::RField<ClassWithTransient> f("f");
std::cout << "value size: " << f.GetValueSize() << ", alignment: " << f.GetAlignment() << "\n";
}
output:
Processing ntuple_class_align.C...
value size: 12, alignment: 1
This can lead to problems if such class is embedded into a record, for example a std::pair.
Description
RClassField::Attachonly takes into account persistent members to determine alignment:root/tree/ntuple/v7/src/RField.cxx
Lines 1874 to 1879 in 3091720
Reproducer
output:
This can lead to problems if such class is embedded into a record, for example a
std::pair.