#259 closed defect (fixed)
Some METOOLS files not following C++ template standards
Reported by: | Generic User (don't modify these fields) | Owned by: | support@sherpa-mc.de |
---|---|---|---|
Priority: | major | Milestone: | rel-2.0.0 |
Component: | Unknown | Version: | 2.0.beta2 |
Keywords: | c++ standards | Cc: | David.Hall@physics.ox.ac.uk |
Description
Hello, I recently tried to compile Sherpa using clang. It gave a couple of errors relating to template use. I believe that the current Sherpa code is not quite following the C++ standards that clang is quite fussy about.
The first point is the error: use 'template' keyword to treat 'Get' as a dependent template name. The error is explained here (http://stackoverflow.com/questions/3786360/confusing-template-error). This appears for several places in the code, so I provide a list at the end of the message for your convenience.
The second error is more complicated and is explained here (http://clang.llvm.org/compatibility.html#dep_lookup). In file included from Phase_Space_Handler.C:16: ../../ATOOLS/Phys/Blob.H:219:6: error: call to function 'operator<<' that is neither visible in the template
definition nor found by argument-dependent lookup
s<<m_data;
Phase_Space_Handler.C:870:16: note: in instantiation of member function
'ATOOLS::Blob_Data<PHASIC::Weight_Info>::operator>>' requested here
template class Blob_Data<Weight_Info>; Phase_Space_Handler.C:860:18: note: 'operator<<' should be declared prior to the call site or in namespace 'PHASIC'
std::ostream & operator<<(std::ostream & s, const PHASIC::Weight_Info & wi)
However, I struggle to know how to solve this without a deeper knowledge of your code.
Cheers, David
inreplace 'METOOLS/Currents/S_C.C', 'CScalarType_Vector *j(m_j[i].Get<CScalarType>());', 'CScalarType_Vector *j(m_j[i].template Get<CScalarType>());'
inreplace 'METOOLS/Currents/F_C.C', 'CSpinorType_Vector *j(m_j[i].Get<CSpinorType>());', 'CSpinorType_Vector *j(m_j[i].template Get<CSpinorType>());' inreplace 'METOOLS/Currents/V_C.C', 'CVec4Type_Vector *j(m_j[i].Get<CVec4Type>());', 'CVec4Type_Vector *j(m_j[i].template Get<CVec4Type>());' inreplace 'METOOLS/Currents/T_C.C', 'CAsT4Type_Vector *j(m_j[i].Get<CAsT4Type>());', 'CAsT4Type_Vector *j(m_j[i].template Get<CAsT4Type>());' inreplace 'METOOLS/Vertices/SSVV_LC.C', 'CVec4Type_Vector *ca(jit[m_n[1]]->Get<CVec4Type>());', 'CVec4Type_Vector *ca(jit[m_n[1]]->template Get<CVec4Type>());' inreplace 'METOOLS/Vertices/SSVV_LC.C', 'CVec4Type_Vector *cb(jit[m_n[2]]->Get<CVec4Type>());', 'CVec4Type_Vector *cb(jit[m_n[2]]->template Get<CVec4Type>());' inreplace 'METOOLS/Vertices/SSVV_LC.C', 'CScalarType_Vector *ce(jit[m_n[0]]->Get<CScalarType>());', 'CScalarType_Vector *ce(jit[m_n[0]]->template Get<CScalarType>());' inreplace 'METOOLS/Vertices/SSVV_LC.C', 'CScalarType_Vector *ca(jit[m_n[0]]->Get<CScalarType>());', 'CScalarType_Vector *ca(jit[m_n[0]]->template Get<CScalarType>());' inreplace 'METOOLS/Vertices/SSVV_LC.C', 'CScalarType_Vector *cb(jit[m_n[1]]->Get<CScalarType>());', 'CScalarType_Vector *cb(jit[m_n[1]]->template Get<CScalarType>());' inreplace 'METOOLS/Vertices/SSVV_LC.C', 'CVec4Type_Vector *ce(jit[m_n[2]]->Get<CVec4Type>());', 'CVec4Type_Vector *ce(jit[m_n[2]]->template Get<CVec4Type>());' inreplace 'METOOLS/Vertices/VVVV_LC.C', 'CVec4Type_Vector *ca(jit[m_n[0]]->Get<CVec4Type>());', 'CVec4Type_Vector *ca(jit[m_n[0]]->template Get<CVec4Type>());' inreplace 'METOOLS/Vertices/VVVV_LC.C', 'CVec4Type_Vector *cb(jit[m_n[1]]->Get<CVec4Type>());', 'CVec4Type_Vector *cb(jit[m_n[1]]->template Get<CVec4Type>());' inreplace 'METOOLS/Vertices/VVVV_LC.C', 'CVec4Type_Vector *ce(jit[m_n[2]]->Get<CVec4Type>());', 'CVec4Type_Vector *ce(jit[m_n[2]]->template Get<CVec4Type>());'
Attachments (2)
Change History (7)
Changed 11 years ago by
Attachment: | clang.patch added |
---|
comment:1 Changed 11 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
I've already fixed thos issues last week -- see the attached patch. Please re-open this ticket if you still have problems.
comment:2 Changed 11 years ago by
Hi Hendrik,
Thank you for the patch! Is there also a version for the stable release 1.4.3? (This patch fails for that version)
Cheers, David
comment:3 Changed 11 years ago by
I'll have a look, but it will take until next week, since I'm actually at a meeting in London at the moment. You should be able to have a look at the patch and identify the one bit that's needed for you. It's moving the operator definition from Phase_Space_Handler.C to its header file and inlining it.
Changed 11 years ago by
Attachment: | 143_clang.patch added |
---|
Patch for Sherpa-1.4.3 to compile under clang
comment:4 follow-up: 5 Changed 11 years ago by
Hi Hendrik, I have attached a patch for 1.4.3 to this ticket now. Cheers, David
fixing clang errors/warnings