From b8e705da0eb4a21a890681ce4d7a48089ef4b655 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 1 Jun 2019 14:11:31 +0200 Subject: [PATCH] LibCore: CObjects without is specialization shouldn't LARP as others. --- AK/StdLibExtras.h | 1 + LibCore/CObject.h | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/AK/StdLibExtras.h b/AK/StdLibExtras.h index f233ab4219..3219f896d7 100644 --- a/AK/StdLibExtras.h +++ b/AK/StdLibExtras.h @@ -293,3 +293,4 @@ using AK::max; using AK::min; using AK::move; using AK::swap; +using AK::RemoveConst; diff --git a/LibCore/CObject.h b/LibCore/CObject.h index fda00cd976..3e73d44fda 100644 --- a/LibCore/CObject.h +++ b/LibCore/CObject.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include @@ -63,19 +64,22 @@ private: }; template -inline bool is(const CObject&) { return true; } +inline bool is(const CObject&) { return false; } + +template<> +inline bool is(const CObject&) { return true; } template inline T& to(CObject& object) { - ASSERT(is(object)); + ASSERT(is::Type>(object)); return static_cast(object); } template inline const T& to(const CObject& object) { - ASSERT(is(object)); + ASSERT(is::Type>(object)); return static_cast(object); }