Restore legacy default allocation behavior in SmartPointer default constructor to fix crashes in tests
This commit is contained in:
@@ -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<T>) {
|
||||
m_counter = new ReferenceCounter(new T());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Constructor from nullptr.
|
||||
|
||||
Reference in New Issue
Block a user