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.5
Change-Id: I60f036eafc808862a1abee72fd53023dd99b4cc3
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit c10072895d1061e258d23f3cc2a9050de5236a46)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 5ca7ad268a3b2fb68c9505eee888aa62c2aa6189)
This commit is contained in:
Giuseppe D'Angelo 2025-01-13 14:23:37 +01:00 committed by Qt Cherry-pick Bot
parent 7e2ab774bd
commit db6f3331d9

View File

@ -32,7 +32,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
@ -47,7 +48,8 @@ protected:
class QVLABaseBase
{
protected:
~QVLABaseBase() = default;
QVLABaseBase() = default;
QT_DECLARE_RO5_SMF_AS_DEFAULTED(QVLABaseBase)
qsizetype a; // capacity
qsizetype s; // size
@ -79,7 +81,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); }