Genvector template: dictionary namespace scope problem

Hi

I’m trying to implement an event class that holds an std::vector of LorentzVector of type

ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t>>

In the header, I have

typedef ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t>> FAVector4;

class FAEvent
{
...
    std::vector<FAVector4> vec4;
...
};

In the LinkDef:

#pragma link C++ typedef FAVector4;
#pragma link C++ class ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t>>+;
#pragma link C++ class std::vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t>>>+;

The problem seems to be that rootcling does not put the scope operator :: in front of the global ROOT namespace in dictionary methods like

// Function generating the singleton type initializer
static TGenericClassInfo *GenerateInitInstanceLocal(const vector<|:: MISSING HERE |ROOT::Math::LorentzVector<|:: MISSING HERE |ROOT::Math::PxPyPzE4D<Double32_t> > >*)
{
   vector<|:: MISSING HERE |ROOT::Math::LorentzVector<|:: MISSING HERE |ROOT::Math::PxPyPzE4D<Double32_t> > > *ptr = 0;

Any clever trick to circumvent this problem?

Many thanks,
Dominik

What error does the compiler print? Which version of ROOT are you using?

Sorry, forgot to indicate this. I’m using ROOT 6.16.00 at the moment with gcc (Debian 8.3.0-6) 8.3.0. Just compiling 6.18.04 to check with the current version.

Compiler errors:

/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘ROOT::TGenericClassInfo* ROOT::GenerateInitInstanceLocal(const ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> >*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:168:69: error: template argument 1 is invalid
       ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > *ptr = 0;
                                                                     ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:169:131: error: template argument 1 is invalid
       static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >));
                                                                                                                                   ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:172:88: error: template argument 1 is invalid
                   typeid(::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >), ::ROOT::Internal::DefineBehavior(ptr, ptr),
                                                                                        ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:174:88: error: template argument 1 is invalid
                   sizeof(::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >) );
                                                                                        ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: At global scope:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:183:158: error: template argument 1 is invalid
    static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init));
                                                                                                                                                              ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:183:90: error: expected primary-expression before ‘const’
    static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init));
                                                                                          ^~~~~
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:183:90: error: expected ‘)’ before ‘const’
    static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init));
                                                                                         ~^~~~~
                                                                                          )
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘TClass* ROOT::ROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgR_Dictionary()’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:187:128: error: template argument 1 is invalid
       TClass* theClass =::ROOT::GenerateInitInstanceLocal((const ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)0x0)->GetClass();
                                                                                                                                ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:187:60: error: expected primary-expression before ‘const’
       TClass* theClass =::ROOT::GenerateInitInstanceLocal((const ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)0x0)->GetClass();
                                                            ^~~~~
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:187:60: error: expected ‘)’ before ‘const’
       TClass* theClass =::ROOT::GenerateInitInstanceLocal((const ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)0x0)->GetClass();
                                                           ~^~~~~
                                                            )
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void* ROOT::new_ROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgR(void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2442:129: error: template argument 1 is invalid
       return  p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > : new ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >;
                                                                                                                                 ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2442:199: error: template argument 1 is invalid
 ((::ROOT::Internal::TOperatorNewHelper*)p) ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > : new ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >;
                                                                                                                                                                                ^

/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void* ROOT::newArray_ROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgR(Long_t, void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2445:128: error: template argument 1 is invalid
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements] : new ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements];
                                                                                                                                ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2445:129: error: expected ‘:’ before ‘[’ token
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements] : new ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements];
                                                                                                                                 ^
                                                                                                                                 :
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In lambda function:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2445:141: error: expected ‘{’ before ‘:’ token
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements] : new ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements];
                                                                                                                                             ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void* ROOT::newArray_ROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgR(Long_t, void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2445:140: error: expected ‘;’ before ‘:’ token
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements] : new ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements];
                                                                                                                                            ^~
                                                                                                                                            ;
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2445:141: error: expected primary-expression before ‘:’ token
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements] : new ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >[nElements];
                                                                                                                                             ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void ROOT::delete_ROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgR(void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2449:78: error: template argument 1 is invalid
       delete ((::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)p);
                                                                              ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2449:80: error: expected primary-expression before ‘)’ token
       delete ((::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)p);
                                                                                ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2449:81: error: expected ‘)’ before ‘p’
       delete ((::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)p);
              ~                                                                  ^
                                                                                 )
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void ROOT::deleteArray_ROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgR(void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2452:81: error: template argument 1 is invalid
       delete [] ((::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)p);
                                                                                 ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2452:83: error: expected primary-expression before ‘)’ token
       delete [] ((::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)p);
                                                                                   ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2452:84: error: expected ‘)’ before ‘p’
       delete [] ((::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >*)p);
                 ~                                                                  ^
                                                                                    )
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void ROOT::destruct_ROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgR(void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:2455:77: error: template argument 1 is invalid
       typedef ::ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > current_t;
                                                                             ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: At global scope:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 1 is invalid
    static TGenericClassInfo *GenerateInitInstanceLocal(const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)
                                                                                                                                   ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 1 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 1 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 1 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 1 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:131: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:62: error: invalid use of template-name ‘std::vector’ without an argument list
    static TGenericClassInfo *GenerateInitInstanceLocal(const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)
                                                              ^~~~~~
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:62: note: class template argument deduction is only available with -std=c++17 or -std=gnu++17
In file included from /usr/include/c++/8/vector:64,
                 from /opt/root/v6.16.00/include/TGenericClassInfo.h:15,
                 from /opt/root/v6.16.00/include/Rtypes.h:192,
                 from /opt/root/v6.16.00/include/TObject.h:17,
                 from /opt/root/v6.16.00/include/TNamed.h:25,
                 from /opt/root/v6.16.00/include/TDictionary.h:44,
                 from /opt/root/v6.16.00/include/TClass.h:23,
                 from /home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:13:
/usr/include/c++/8/bits/stl_vector.h:339:11: note: ‘template<class _Tp, class _Alloc> class std::vector’ declared here
     class vector : protected _Vector_base<_Tp, _Alloc>
           ^~~~~~
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:68: error: expected ‘,’ or ‘...’ before ‘<’ token
    static TGenericClassInfo *GenerateInitInstanceLocal(const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)
                                                                    ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘ROOT::TGenericClassInfo* ROOT::GenerateInitInstanceLocal(int)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3525:76: error: template argument 1 is invalid
       vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > > *ptr = 0;
                                                                            ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3525:76: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3526:138: error: template argument 1 is invalid
       static ::TVirtualIsAProxy* isa_proxy = new ::TIsAProxy(typeid(vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >));
                                                                                                                                          ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3526:138: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3529:95: error: template argument 1 is invalid
                   typeid(vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >), ::ROOT::Internal::DefineBehavior(ptr, ptr),
                                                                                               ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3529:95: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3531:95: error: template argument 1 is invalid
                   sizeof(vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >) );
                                                                                               ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3531:95: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3537:173: error: template argument 1 is invalid
    instance.AdoptCollectionProxyInfo(TCollectionProxyInfo::Generate(TCollectionProxyInfo::Pushback< vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > > >()));
                                                                                                                                                                          ^

/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3537:173: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3537:175: error: template argument 1 is invalid
    instance.AdoptCollectionProxyInfo(TCollectionProxyInfo::Generate(TCollectionProxyInfo::Pushback< vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > > >()));
                                                                                                                                                                            ^

/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: At global scope:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3541:165: error: template argument 1 is invalid
    static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init));
                                                                                                                                                                     ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3541:165: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3541:90: error: expected primary-expression before ‘const’
    static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init));
                                                                                          ^~~~~
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3541:90: error: expected ‘)’ before ‘const’
    static ::ROOT::TGenericClassInfo *_R__UNIQUE_DICT_(Init) = GenerateInitInstanceLocal((const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)0x0); R__UseDummy(_R__UNIQUE_DICT_(Init));
                                                                                         ~^~~~~
                                                                                          )
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘TClass* ROOT::vectorlEROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgRsPgR_Dictionary()’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3545:135: error: template argument 1 is invalid
       TClass* theClass =::ROOT::GenerateInitInstanceLocal((const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)0x0)->GetClass();
                                                                                                                                       ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3545:135: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3545:60: error: expected primary-expression before ‘const’
       TClass* theClass =::ROOT::GenerateInitInstanceLocal((const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)0x0)->GetClass();
                                                            ^~~~~
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3545:60: error: expected ‘)’ before ‘const’
       TClass* theClass =::ROOT::GenerateInitInstanceLocal((const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)0x0)->GetClass();
                                                           ~^~~~~
                                                            )
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void* ROOT::new_vectorlEROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgRsPgR(void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3558:136: error: template argument 1 is invalid
       return  p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > > : new vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >;
                                                                                                                                        ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3558:136: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3558:213: error: template argument 1 is invalid
 rnal::TOperatorNewHelper*)p) vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > > : new vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >;
                                                                                                                                                                                ^

/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3558:213: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void* ROOT::newArray_vectorlEROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgRsPgR(Long_t, void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3561:135: error: template argument 1 is invalid
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements] : new vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements];
                                                                                                                                       ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3561:135: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3561:136: error: expected ‘:’ before ‘[’ token
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements] : new vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements];
                                                                                                                                        ^
                                                                                                                                        :
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In lambda function:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3561:148: error: expected ‘{’ before ‘:’ token
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements] : new vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements];
                                                                                                                                                    ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void* ROOT::newArray_vectorlEROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgRsPgR(Long_t, void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3561:147: error: expected ‘;’ before ‘:’ token
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements] : new vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements];
                                                                                                                                                   ^~
                                                                                                                                                   ;
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3561:148: error: expected primary-expression before ‘:’ token
       return p ? ::new((::ROOT::Internal::TOperatorNewHelper*)p) vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements] : new vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >[nElements];
                                                                                                                                                    ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void ROOT::delete_vectorlEROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgRsPgR(void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3565:85: error: template argument 1 is invalid
       delete ((vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)p);
                                                                                     ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3565:85: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3565:87: error: expected primary-expression before ‘)’ token
       delete ((vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)p);
                                                                                       ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3565:88: error: expected ‘)’ before ‘p’
       delete ((vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)p);
              ~                                                                         ^
                                                                                        )
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void ROOT::deleteArray_vectorlEROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgRsPgR(void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3568:88: error: template argument 1 is invalid
       delete [] ((vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)p);
                                                                                        ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3568:88: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3568:90: error: expected primary-expression before ‘)’ token
       delete [] ((vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)p);
                                                                                          ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3568:91: error: expected ‘)’ before ‘p’
       delete [] ((vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)p);
                 ~                                                                         ^
                                                                                           )
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: In function ‘void ROOT::destruct_vectorlEROOTcLcLMathcLcLLorentzVectorlEROOTcLcLMathcLcLPxPyPzE4DlEDouble32_tgRsPgRsPgR(void*)’:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3571:84: error: template argument 1 is invalid
       typedef vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > > current_t;
                                                                                    ^
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3571:84: error: template argument 2 is invalid
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx: At global scope:
/home/werthm/src/ROOT/FooAna/build/G__FooAna.cxx:3523:30: warning: ‘ROOT::TGenericClassInfo* ROOT::GenerateInitInstanceLocal(int)’ defined but not used [-Wunused-function]
    static TGenericClassInfo *GenerateInitInstanceLocal(const vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > >*)
                              ^~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/FooAna.dir/build.make:301: CMakeFiles/FooAna.dir/G__FooAna.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/FooAna.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

The problem is still there on 6.18/04

This dictionary for ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> > is already provide has part of the genvector library (but not for vector<ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<Double32_t> >>)

and thus the code as-is does compile (but admittedly would be better we the change you propose).

So something in the header files passed to rootcling is making things odd.

To debug this, I would

a) reproduce the problem with a rootcling invocation that takes the same headers but request the dicitonary for the one LorentzVector instantiation.

b) remove headers one by one until I find the one tickling the problem.

c) if the only header leaf is the ones defining LorentzVector and PxPyPzE4D then we need to start looking at the set of compiler flag uses.

Cheers,
Philippe.

Hi Philippe

Thanks for your quick reply.

In a minimal example (see below), the problem seems to be absent. However, my event class is in fact a template itself and there is a whole library around it.

Could you please explain a bit more what headers I should remove and how to invoke rootcling?

Many thanks,
Dominik

example.tar.gz (533 Bytes)

Your build system does invoke rootcling, the command line that it uses is what I was recommending to start from.

Alternatively, you can start from you example:

rootcling -f G__FooAna.cxx Event.h LinkDef.h
g++ Event.h -c -o Event.o `root-config --cflags`

and then add all the headers from your package and see it breaks.

If with all the header from your package it does not fail then it might be one of the flag that are passed to rootcling by your build system that is causing the problem.

Note that a plausing cause of the problem would a statement like:

using namespace ROOT;

in one of your headers.

Cheers,
Philippe.

Hi Philippe

First, my example was incomplete as I wasn’t even compiling the dictionary :-). I’m attaching an improved version for future reference.

I might have found a first problem, I indeed have a “using namespace XY” in a header where XY is an internal namespace of the library with utility methods and such.

So, is there a way to keep the “using” statement or do I need to get rid of it and address the members of the namespace directly?

Many thanks,
Dominik

example2.tar.gz (746 Bytes)

Hi,

In general, no header should have a ‘using namespace XY’ as it essentially negates the purpose of the namespace (name separation). It is however usually fine to have such statement inside a source file.

Anyway until you actually find the header(s) that provoke the compilation it is premature to come to any conclusion :slight_smile:

Cheers,
Philippe.

Hi Philippe

It’s working now! Yeah, I normally don’t use “using namespace”, this only file was an exception due to cosmetics, but never again :slight_smile:

Thanks a lot for your help!

Cheers,
Dominik

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