From c10072895d1061e258d23f3cc2a9050de5236a46 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Mon, 13 Jan 2025 14:23:37 +0100 Subject: [PATCH] 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 --- src/corelib/tools/qvarlengtharray.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/corelib/tools/qvarlengtharray.h b/src/corelib/tools/qvarlengtharray.h index cb148075e3f..5e9a335abc0 100644 --- a/src/corelib/tools/qvarlengtharray.h +++ b/src/corelib/tools/qvarlengtharray.h @@ -33,7 +33,8 @@ class QVLAStorage { template 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 QVLABase : public QVLABaseBase { protected: - ~QVLABase() = default; + QVLABase() = default; + QT_DECLARE_RO5_SMF_AS_DEFAULTED(QVLABase) public: T *data() noexcept { return static_cast(ptr); }