Cling discover "typedef" and "using" instructions

Hi, I just noticed that in my libraries the typedef & using aliases are not detected in interactive ROOT. I have declared them as following :


#ifndef _MYCLASS_GUARD_H
#define _MYCLASS_GUARD_H

#include "MyNamespace/TMyClassT.h"
using TMyClass  = Namespace::TMyClassT<float>;
 // or using typedef
 // typedef Namespace::TMyClassT<float> TMyClass;

#pragma link C++ class TTensor+;
using TMyClassD = Namespace::TMyClassT<double>; 
 // or using typedef
 // typedef Namespace::TMyClassT<float> TMyClass;

#endif

I am actually getting Namespace::TMyClassT in my interactive root shell while using TAB, so I think my LinkDef.h is correct, but this is not working for aliases.
My only option at the moment is to define TMyClass as a real class and inherit Namespace::TMyClassT including constructor including `#pragma link C++ class TMyClass+;.

Am I doing something wrong here or is that the only solution ? I have actually found some documentation about typedef here Chapter: Addinga Class and also included the pragma in such way #pragma link C++ typedef TMyClass+;


ROOT Version: ROOT 6.34
Platform: MacOS
Compiler: Apple Clang 15


For the typedef pragma, you’d not use the trailing plus (+), i.e. it should be

#pragma link C++ typedef TMyClass;

I actually tried both, but the last one was with with (+). I will double check with this typedef pragma again.

I just checked today and I confirm without (+) I still can’t get that TAB completion through the interactive root.

Just checked, you’re right, tab completion for typedefs is not implemented even with the correct dictionary registration of the typedef. I created an issue to discuss this:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.