QVLA*: honor the RO5

The various base classes that abstract away template-independent parts
of QVLA have protected destructors to prevent slicing. Re-add the
special 5 (using the macro) and a defaulted default constructor.

Pick-to: 6.9 6.8 6.5
Change-Id: I60f036eafc808862a1abee72fd53023dd99b4cc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Giuseppe D'Angelo 2025-01-13 14:23:37 +01:00
parent fcb57391f7
commit c10072895d

View File

@ -33,7 +33,8 @@ class QVLAStorage
{
template <size_t> class print;
protected:
~QVLAStorage() = default;
QVLAStorage() = default;
QT_DECLARE_RO5_SMF_AS_DEFAULTED(QVLAStorage)
alignas(Align) char array[Prealloc * (Align > Size ? Align : Size)];
QT_WARNING_PUSH
@ -48,7 +49,8 @@ protected:
class QVLABaseBase
{
protected:
~QVLABaseBase() = default;
QVLABaseBase() = default;
QT_DECLARE_RO5_SMF_AS_DEFAULTED(QVLABaseBase)
qsizetype a; // capacity
qsizetype s; // size
@ -80,7 +82,8 @@ template<class T>
class QVLABase : public QVLABaseBase
{
protected:
~QVLABase() = default;
QVLABase() = default;
QT_DECLARE_RO5_SMF_AS_DEFAULTED(QVLABase)
public:
T *data() noexcept { return static_cast<T *>(ptr); }