From 59cb661ee6740d09b687d29efb0f44924d8c4606 Mon Sep 17 00:00:00 2001 From: Jonas Rembser Date: Tue, 14 Jul 2026 09:05:31 +0200 Subject: [PATCH] [RF] Make RooAbsDataHelper::Exec well-formed for an empty parameter pack MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The body of RooAbsDataHelper::Exec used a range-based for loop over a braced-init-list of the parameter pack: for (auto &&val : {static_cast(values)...}) With an empty pack this becomes `for (auto &&val : {})`, which is ill-formed since the element type cannot be deduced from an empty list. The empty-pack instantiation is required to be well-formed by RDataFrame: instantiating Book (as done when booking the helper from Python without explicit column types) compiles the no-columns branch of Book, which instantiates RAction> and with it Exec<>. This went unnoticed so far because cling's TClingCallFunc happens to skip the vtable-driven instantiation of the ill-formed virtual RAction::Run in the never-taken branch. The stricter wrapper compilation in CppInterOp surfaces the error, which made rf408_RDataFrameToRooFit.py fail with cppyy on top of CppInterOp. Use a fold expression instead, which is valid for an empty pack. 🤖 Done with the help of AI. --- roofit/roofitcore/inc/RooAbsDataHelper.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roofit/roofitcore/inc/RooAbsDataHelper.h b/roofit/roofitcore/inc/RooAbsDataHelper.h index 5347b3b862fb0..fb2c714af9327 100644 --- a/roofit/roofitcore/inc/RooAbsDataHelper.h +++ b/roofit/roofitcore/inc/RooAbsDataHelper.h @@ -143,9 +143,10 @@ class RooAbsDataHelper : public RooFit::Detail::RooAbsDataFiller, void Exec(unsigned int slot, ColumnTypes... values) { std::vector &vector = _events[slot]; - for (auto &&val : {static_cast(values)...}) { - vector.push_back(val); - } + // A fold expression is used instead of iterating over a + // std::initializer_list so that this compiles also with an empty pack + // (an instantiation that RDataFrame requires to be well-formed). + (vector.push_back(static_cast(values)), ...); ExecImpl(sizeof...(values), vector); }