Skip to content

[ntuple] RNTuple error when serializing TClass typedef members #7861

@mxxo

Description

@mxxo
  • Checked for duplicates

Describe the bug

TClass members which are typedefs of supported RNTuple types are not being resolved to their true types during serialization, which is causing runtime errors.

To Reproduce

Define a custom class with, e.g. a typedef'd std::string member intended to be serialized using rootcling and TClass

class CustomStruct { 
   typedef std::string typedef_string;
   typedef_string str;
};

auto classField = RField<CustomStruct>("field");

Trying to create this field fails at run time:

C++ exception with description "Field npos has unknown type const string::size_type (unchecked RResult access!)
At:
  static ROOT::Experimental::RResult<std::unique_ptr<ROOT::Experimental::Detail::RFieldBase> >
ROOT::Experimental::Detail::RFieldBase::Create(const string&, const string&) 
[/home/max/projects/rootdev/root/tree/ntuple/v7/src/RField.cxx:202]

Setup

ROOT master

Additional context

This is likely resolved by using GetTrueTypeName instead of GetFullTypeName here (thank you @jblomer):

auto subField = Detail::RFieldBase::Create(dataMember->GetName(), dataMember->GetFullTypeName()).Unwrap();

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions