From af585e0bd03f2d083fa1ee1620ebbfca9617f031 Mon Sep 17 00:00:00 2001 From: Dentomologist Date: Sun, 4 Jan 2026 15:47:20 -0800 Subject: [PATCH] Metal: Move ObjectCache constructor and destructor Move the constructor and destructor after the definition of the class `Internal`. This fixes an error generated by Clang from the destructor of `std::unique_ptr` when setting the standard version to c++23: `invalid application of 'sizeof' to an incomplete type 'Metal::ObjectCache::Internal'`. --- .../VideoBackends/Metal/MTLObjectCache.mm | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm index c4ecfc0713..7dce7a0f34 100644 --- a/Source/Core/VideoBackends/Metal/MTLObjectCache.mm +++ b/Source/Core/VideoBackends/Metal/MTLObjectCache.mm @@ -27,16 +27,6 @@ std::unique_ptr Metal::g_object_cache; static void SetupDepthStencil( MRCOwned> (&dss)[Metal::DepthStencilSelector::N_VALUES]); -Metal::ObjectCache::ObjectCache() -{ - m_internal = std::make_unique(); - SetupDepthStencil(m_dss); -} - -Metal::ObjectCache::~ObjectCache() -{ -} - void Metal::ObjectCache::Initialize(MRCOwned> device) { g_device = std::move(device); @@ -554,6 +544,17 @@ public: } }; +Metal::ObjectCache::ObjectCache() +{ + m_internal = std::make_unique(); + SetupDepthStencil(m_dss); +} + +// This is defined here instead of the header so that the definition of Internal is visible when +// m_internal is destroyed, preventing a compile error caused by calling unique_ptr's destructor +// with an incomplete type. +Metal::ObjectCache::~ObjectCache() = default; + std::unique_ptr Metal::ObjectCache::CreatePipeline(const AbstractPipelineConfig& config) {