From 4bc0a6b116fe45aaed0af3ca33950b2e549f553e Mon Sep 17 00:00:00 2001 From: Vladimir Pinchuk Date: Thu, 10 Oct 2024 13:08:27 +0300 Subject: [PATCH] etl/type_traits: fix etl::is_base_of for the case when TDerived is final --- include/etl/type_traits.h | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/include/etl/type_traits.h b/include/etl/type_traits.h index 47489c2cc..327f164be 100644 --- a/include/etl/type_traits.h +++ b/include/etl/type_traits.h @@ -627,18 +627,13 @@ namespace etl struct is_base_of { private: - - template struct dummy {}; - struct internal: TDerived, dummy{}; - static TBase* check(TBase*) { return (TBase*)0; } - template - static char check(dummy*) { return 0; } + static char check(...) { return 0; } public: - static const bool value = (sizeof(check((internal*)0)) == sizeof(TBase*)); + static const bool value = (sizeof(check((TDerived*)0)) == sizeof(TBase*)); }; // For when TBase or TDerived is a fundamental type.