diff --git a/rpcs3/util/shared_ptr.hpp b/rpcs3/util/shared_ptr.hpp index 3bafffb16a..ba2df2633f 100644 --- a/rpcs3/util/shared_ptr.hpp +++ b/rpcs3/util/shared_ptr.hpp @@ -25,12 +25,6 @@ namespace stx static thread_local const #endif fake_t> sample{}; - - template - struct can_static_cast : std::false_type {}; - - template - struct can_static_cast(std::declval()))>> : std::true_type {}; } // Classify compile-time information available for pointers @@ -55,13 +49,13 @@ namespace stx { return same_ptr::yes; } - else if constexpr (detail::can_static_cast::value && !std::is_abstract_v) + else if constexpr (PtrCastable && !std::is_abstract_v) { return is_same_ptr_test() ? same_ptr::yes : same_ptr::no; } - else if constexpr (detail::can_static_cast::value && !std::is_abstract_v) + else if constexpr (PtrCastable && !std::is_abstract_v) { - return is_same_ptr_test() ? same_ptr::yes : same_ptr::no; + return is_same_ptr_test() ? same_ptr::yes : same_ptr::no; } return same_ptr::maybe; diff --git a/rpcs3/util/types.hpp b/rpcs3/util/types.hpp index 3ed968736f..6cdb159c04 100644 --- a/rpcs3/util/types.hpp +++ b/rpcs3/util/types.hpp @@ -1010,3 +1010,10 @@ constexpr auto fill_array(const T&... args) { return fill_array_t{{args...}}; } + +template +concept PtrCastable = requires(const volatile X* x, const volatile Y* y) +{ + static_cast(x); + static_cast(y); +};