Suppress bogus warning from gcc 12

It says:

/home/qt/qt6dev-src/qtbase/src/corelib/tools/qcontainertools_impl.h: In function ‘auto QtPrivate::sequential_erase_with_copy(Container&, const T&) [with Container = QList<void (*)()>; T = void (*)()]’:
/home/qt/qt6dev-src/qtbase/src/corelib/tools/qcontainertools_impl.h:383:14: error: ‘D.282000’ is used uninitialized [-Werror=uninitialized]
  383 |     const T &tCopy = CopyProxy(t);
      |              ^~~~~
cc1plus: all warnings being treated as errors

We can avoid storing the value into a const ref to silence this. Storing
a non-const pointer into a const reference is quite confusing anyway.

Fixes: QTBUG-123486
Pick-to: 6.6 6.5
Change-Id: I77fcd871724ce7f81b9567603dc5b4cb31f121c5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
(cherry picked from commit 4662e80755b3002585280cfe9076d2c6c14f1e5b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ulf Hermann 2024-03-19 09:25:42 +01:00 committed by Qt Cherry-pick Bot
parent a6fba61545
commit 24cc41f77f

View File

@ -373,8 +373,7 @@ template <typename Container, typename T>
auto sequential_erase_with_copy(Container &c, const T &t)
{
using CopyProxy = std::conditional_t<std::is_copy_constructible_v<T>, T, const T &>;
const T &tCopy = CopyProxy(t);
return sequential_erase(c, tCopy);
return sequential_erase(c, CopyProxy(t));
}
template <typename Container, typename T>