tst_qstringapisymmetry: silence a GCC warning

GCC complains:
inlined from ‘constexpr QAnyStringView::QAnyStringView(const Container&) [with Container = QVarLengthArray<QChar, 1023>; typename std::enable_if<disjunction_v<QtPrivate::IsContainerCompatibleWithQStringView<T, void>, QtPrivate::IsContainerCompatibleWithQUtf8StringView<T, void> >, bool>::type <anonymous> = true]’ at src/corelib/text/qanystringview.h:215:64,
    inlined from ‘void tst_QStringApiSymmetry::overload() [with T = QVarLengthArray<QChar, 1023>]’ at /home/ahmad/devo/qt6-git/qtbase-qglobal/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp:1178:17:
src/corelib/text/qanystringview.h:187:47: warning: ‘t’ may be used uninitialized [-Wmaybe-uninitialized]
  187 |         : m_data{str}, m_size{encodeType<Char>(str, len)}
      |                               ~~~~~~~~~~~~~~~~^~~~~~~~~~

Clang doesn't warn about this.

Change-Id: I3476236630e886b087856acd22054bfb35deb451
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Ahmad Samir 2023-03-19 20:37:11 +02:00
parent 40045aeec8
commit b58606ed85

View File

@ -1170,6 +1170,10 @@ void tst_QStringApiSymmetry::overload()
// check the common overload sets defined above to be free of ambiguities
// for arguments of type T
QT_WARNING_PUSH
// GCC complains about "t" and "ct"
QT_WARNING_DISABLE_GCC("-Wmaybe-uninitialized")
using CT = const T;
T t = {};
@ -1218,6 +1222,7 @@ void tst_QStringApiSymmetry::overload()
overload_sr_v(CT());
}
}
QT_WARNING_POP
}
void tst_QStringApiSymmetry::overload_special()