Bug #19851
messagefacility problem
Description
The following code in larsoftalg produces an error when compiled against messagefacility v2_02_01.
LOG_DEBUG("Geometry") << "detector total volume is " << fTotalVolume->GetName();
The debug build is fine, but the prof build reports this error.
[ 64%] Building CXX object larcorealg/larcorealg/Geometry/CMakeFiles/larcorealg_Geometry.dir/AuxDetGeo.cxx.o /home/garren/scratch/larsoft/v06_75_00_01/srcs/larcorealg/larcorealg/Geometry/AuxDetGeo.cxx: In constructor ‘geo::AuxDetGeo::AuxDetGeo(std::vector<const TGeoNode*>&, int)’: /home/garren/scratch/larsoft/v06_75_00_01/srcs/larcorealg/larcorealg/Geometry/AuxDetGeo.cxx:41:59: error: no match for ‘operator<<’ (operand types are ‘mf::NeverLogger_’ and ‘const char*’) LOG_DEBUG("Geometry") << "detector total volume is " << fTotalVolume->GetName(); In file included from /home/garren/scratch/larsoft/v06_75_00_01/srcs/larcorealg/larcorealg/Geometry/AuxDetGeo.cxx:19:0: /products/messagefacility/v2_02_01/include/messagefacility/MessageLogger/MessageLogger.h:92:5: note: candidate: template<class T> std::enable_if_t<((! std::is_same<T, const char*>::value) && (! std::is_same<T, const char* const>::value)), mf::NeverLogger_&> mf::NeverLogger_::operator<<(const T&) & operator<<(T const&) & ^~~~~~~~ /products/messagefacility/v2_02_01/include/messagefacility/MessageLogger/MessageLogger.h:92:5: note: template argument deduction/substitution failed: /products/messagefacility/v2_02_01/include/messagefacility/MessageLogger/MessageLogger.h:102:5: note: candidate: template<class T> std::enable_if_t<((! std::is_same<T, const char*>::value) && (! std::is_same<T, const char* const>::value)), mf::NeverLogger_&&> mf::NeverLogger_::operator<<(const T&) && operator<<(T const&) && ^~~~~~~~ ....
Although a workaround is possible, we request that this bug be fixed since the workaround changes the behavior. Here is the workaround, which may also be needed for other messagefacility macros.
//LOG_DEBUG("Geometry") << "detector total volume is " << fTotalVolume->GetName(); mf::LogDebug("Geometry") << "detector total volume is " << fTotalVolume->GetName();
History
#1 Updated by Gianluca Petrillo almost 3 years ago
It should be noted that the workaround does not have the same exact functionality as the original code, and a record should be kept of it so that it can be reverted when the library upstream is fixed.
#2 Updated by Kyle Knoepfel almost 3 years ago
Correct, Gianluca.
#3 Updated by Lynn Garren almost 3 years ago
I have found one use of LOG_TRACE in lareventdisplay with the same problem.
#4 Updated by Kyle Knoepfel almost 3 years ago
- Status changed from New to Resolved
- Assignee set to Kyle Knoepfel
- % Done changed from 0 to 100
- SSI Package messagefacility added
This bug is due to a metaprogramming error that is exposed whenever profile builds are enabled. Fixed with commit messagefacility:587d896.
#5 Updated by Kyle Knoepfel almost 3 years ago
- Target version set to 2.11.02
#6 Updated by Kyle Knoepfel almost 3 years ago
- Status changed from Resolved to Closed
#7 Updated by Kyle Knoepfel almost 3 years ago
- Project changed from cet-is to messagefacility
- Scope deleted (
Internal) - Experiment deleted (
LArSoft) - SSI Package deleted (
messagefacility)