Skip to content

Commit 8d87e2b

Browse files
committed
[RF] Fix debug build with C++14
Commit ff86c30 ("[RF] Implement SumW2 correction in new BatchMode with RooFitDriver") introduced some static constexpr. When building with C++14, at least weightVarName requires a declaration because it is odr-used. Provide them for all three variables to avoid undefined references seen in debug builds without compiler optimizations.
1 parent b23135d commit 8d87e2b

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

roofit/roofitcore/res/RooNLLVarNew.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class RooNLLVarNew : public RooAbsReal {
2727

2828
public:
2929
// The names for the weight variables that the RooNLLVarNew expects
30-
static constexpr auto weightVarName = "_weight";
31-
static constexpr auto weightVarNameSumW2 = "_weight_sumW2";
32-
static constexpr auto weightVarNameSumW2Suffix = "_sumW2";
30+
static constexpr const char *weightVarName = "_weight";
31+
static constexpr const char *weightVarNameSumW2 = "_weight_sumW2";
32+
static constexpr const char *weightVarNameSumW2Suffix = "_sumW2";
3333

3434
RooNLLVarNew(){};
3535
RooNLLVarNew(const char *name, const char *title, RooAbsPdf &pdf, RooArgSet const &observables, RooAbsReal *weight,

roofit/roofitcore/src/RooNLLVarNew.cxx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ functions from `RooBatchCompute` library to provide faster computation times.
4040

4141
using namespace ROOT::Experimental;
4242

43+
// Declare constexpr static members to make them available if odr-used in C++14.
44+
constexpr const char *RooNLLVarNew::weightVarName;
45+
constexpr const char *RooNLLVarNew::weightVarNameSumW2;
46+
constexpr const char *RooNLLVarNew::weightVarNameSumW2Suffix;
47+
4348
namespace {
4449

4550
std::unique_ptr<RooAbsReal> createRangeNormTerm(RooAbsPdf const &pdf, RooArgSet const &observables,

0 commit comments

Comments
 (0)