Skip to content

Replace std::string in constexpr with std::string_view

Solves the following errors when compiling with ubsan

../Detector/FT/include/Detector/FT/FTChannelID.h:105:103:   in 'constexpr' expansion of '((std::array<std::__cxx11::basic_string<char>, 4>*)(& LHCb::Detector::FTChannelID::layerStrings))->std::array<std::__cxx11::basic_string<char>, 4>::~array()'
/cvmfs/lhcb.cern.ch/lib/lcg/releases/gcc/13.1.0-b3d18/x86_64-el9/include/c++/13.1.0/array:94:12: error: '(((std::__cxx11::basic_string<char>*)(& LHCb::Detector::FTChannelID::layerStrings.std::array<std::__cxx11::basic_string<char>, 4>::_M_elems)) != 0)' is not a constant expression
   94 |     struct array
      |            ^~~~~
../Detector/FT/include/Detector/FT/FTChannelID.h:113:90:   in 'constexpr' expansion of '((std::array<std::__cxx11::basic_string<char>, 2>*)(& LHCb::Detector::FTChannelID::sideNames))->std::array<std::__cxx11::basic_string<char>, 2>::~array()'
/cvmfs/lhcb.cern.ch/lib/lcg/releases/gcc/13.1.0-b3d18/x86_64-el9/include/c++/13.1.0/array:94:12: error: '(((std::__cxx11::basic_string<char>*)(& LHCb::Detector::FTChannelID::sideNames.std::array<std::__cxx11::basic_string<char>, 2>::_M_elems)) != 0)' is not a constant expression

Goes with !755 LHCb!4564 Rec!3928 (merged) Moore!4968


Validated by

  • Core Software
  • RTA
  • Simulation
Edited by Sebastien Ponce

Merge request reports

Loading