From 40a2337a6ba6ff2c5fd46386ec84432d74347948 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk <21087696+oleksandr-pavlyk@users.noreply.github.com> Date: Mon, 4 Aug 2025 09:40:17 -0500 Subject: [PATCH] Review fix: make nvbenhch_run_error constructable Allow `throw nvbench_run_error("Msg");` to compile. Add comment around definition of nvbench_run_error --- python/src/py_nvbench.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python/src/py_nvbench.cpp b/python/src/py_nvbench.cpp index 89fb718..30b5dd0 100644 --- a/python/src/py_nvbench.cpp +++ b/python/src/py_nvbench.cpp @@ -100,8 +100,13 @@ private: std::shared_ptr m_fn; }; -class nvbench_run_error : std::runtime_error -{}; +// Use struct to ensure public inheritance +struct nvbench_run_error : std::runtime_error +{ + // ask compiler to generate all constructor signatures + // that are defined for the base class + using std::runtime_error::runtime_error; +}; py::handle benchmark_exc{}; class GlobalBenchmarkRegistry