From e4004e0adb77d897fa4b1446a7f3d3c6bce2016f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 23 Dec 2019 21:22:32 +0100 Subject: [PATCH] Provide const overload of ObjectStorage::stored_object() Fixes #1820 --- include/internal/benchmark/catch_constructor.hpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/internal/benchmark/catch_constructor.hpp b/include/internal/benchmark/catch_constructor.hpp index 7525bf01..4fc04042 100644 --- a/include/internal/benchmark/catch_constructor.hpp +++ b/include/internal/benchmark/catch_constructor.hpp @@ -55,11 +55,15 @@ namespace Catch { template void destruct_on_exit(typename std::enable_if::type* = 0) { } - T& stored_object() - { + T& stored_object() { return *static_cast(static_cast(&data)); } + T const& stored_object() const { + return *static_cast(static_cast(&data)); + } + + TStorage data; }; }