From e4379811a34ebc981902cbe44a4a475985a2534e Mon Sep 17 00:00:00 2001 From: AndreaRigoni Date: Thu, 16 Apr 2026 14:29:57 +0000 Subject: [PATCH] Restore legacy default allocation behavior in SmartPointer default constructor to fix crashes in tests --- src/Core/SmartPointer.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Core/SmartPointer.h b/src/Core/SmartPointer.h index 8448d4c..496d367 100644 --- a/src/Core/SmartPointer.h +++ b/src/Core/SmartPointer.h @@ -56,8 +56,13 @@ public: /** * @brief Default constructor. + * Allocates a new T following legacy behavior. */ - SmartPointer() noexcept : m_counter(nullptr) {} + SmartPointer() : m_counter(nullptr) { + if constexpr (std::is_default_constructible_v) { + m_counter = new ReferenceCounter(new T()); + } + } /** * @brief Constructor from nullptr.