From 1d578450dc82843bd4b24f3a6aad2c1a82bbda5e Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Tue, 17 Sep 2024 11:21:05 +0200 Subject: Managed to get hip to compile --- modules/core/c++/common.hpp | 6 +++--- modules/core/c++/error.hpp | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) (limited to 'modules/core') diff --git a/modules/core/c++/common.hpp b/modules/core/c++/common.hpp index f63c531..de464b8 100644 --- a/modules/core/c++/common.hpp +++ b/modules/core/c++/common.hpp @@ -90,7 +90,7 @@ public: /** * Main constructor. */ - ref(T& ref__): + constexpr ref(T& ref__): ref_{&ref__} {} @@ -99,14 +99,14 @@ public: /** * Operator retrieving the itself. */ - T& operator()(){ + constexpr T& operator()(){ return *ref_; } /** * Operator retrieving the itself. */ - const T& operator()() const { + constexpr const T& operator()() const { return *ref_; } }; diff --git a/modules/core/c++/error.hpp b/modules/core/c++/error.hpp index dab297e..ac45fbc 100644 --- a/modules/core/c++/error.hpp +++ b/modules/core/c++/error.hpp @@ -18,7 +18,7 @@ namespace saw { * critical and recoverable errors. Additional code ids can be provided to the * constructor if additional distinctions are necessary. */ -class error { +class error final { public: /** * Type alias @@ -101,7 +101,7 @@ namespace impl { /** * Internal registry for all error types. Is generated dynamically. */ -class error_registry { +class error_registry final { private: struct error_info { error_info() = delete; @@ -301,6 +301,10 @@ public: } }; +/** + * This tries to catch cases where error starts including itself as a type which can happen in more complicated cases. + * So this acts as a type safe guard. + */ template class error_or> { private: error_or() = delete; -- cgit v1.2.3