Make the default ctor of QVarLengthArray implicit
Otherwise "QVarLengthArray<Foo> x = {};" gives a warning. Also, some compilers get confused about "QVarLengthArray()" this way. Task-number: QTBUG-76199 Change-Id: I4296586c0181d3e6e82ca8b7b79aeb9a21645d1f Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
fdef9c8039
commit
c34242c679
@ -61,7 +61,9 @@ template<class T, int Prealloc>
|
||||
class QVarLengthArray
|
||||
{
|
||||
public:
|
||||
inline explicit QVarLengthArray(int size = 0);
|
||||
QVarLengthArray() : QVarLengthArray(0) {}
|
||||
|
||||
inline explicit QVarLengthArray(int size);
|
||||
|
||||
inline QVarLengthArray(const QVarLengthArray<T, Prealloc> &other)
|
||||
: a(Prealloc), s(0), ptr(reinterpret_cast<T *>(array))
|
||||
|
@ -57,6 +57,7 @@ private slots:
|
||||
void initializeListComplex();
|
||||
void insertMove();
|
||||
void nonCopyable();
|
||||
void implicitDefaultCtor();
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
@ -1078,5 +1079,11 @@ void tst_QVarLengthArray::nonCopyable()
|
||||
QVERIFY(ptr6 == vec.at(5).get());
|
||||
}
|
||||
|
||||
void tst_QVarLengthArray::implicitDefaultCtor()
|
||||
{
|
||||
QVarLengthArray<int> def = {};
|
||||
QCOMPARE(def.size(), 0);
|
||||
}
|
||||
|
||||
QTEST_APPLESS_MAIN(tst_QVarLengthArray)
|
||||
#include "tst_qvarlengtharray.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user