From 02e33d3eb26d7d117c4e14eeab0905d43b3bff84 Mon Sep 17 00:00:00 2001 From: Jaby Date: Sun, 8 Jan 2023 15:16:00 +0100 Subject: [PATCH] Fix weird bug in IOPort --- include/PSX/System/IOPorts/ioport.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/PSX/System/IOPorts/ioport.hpp b/include/PSX/System/IOPorts/ioport.hpp index 1e9a7036..1aae0679 100644 --- a/include/PSX/System/IOPorts/ioport.hpp +++ b/include/PSX/System/IOPorts/ioport.hpp @@ -9,8 +9,9 @@ namespace JabyEngine { T value; public: + // decltype(this) instead of IOPort* lead to wrong runtime behaviour somethow... constexpr T read() const { - return const_cast(this)->value; + return const_cast*>(this)->value; } template @@ -24,7 +25,7 @@ namespace JabyEngine { } constexpr void write(const T& value) { - const_cast(this)->value = value; + const_cast*>(this)->value = value; } // We keep this a POD so we will not add assignment operators anymore