qt5base-lts/tests/auto
Fabian Kosmale b83225fcc3 qDebug: Avoid implicit QVariant conversion
This commit restricts operator<<(QDebug lhs, QVariant rhs) to only work
if rhs is actually of type QVariant (instead of any type convertible to
QVariant). This is especially important as
a) we check in QMetaType whether (slightly simplified) QDebug{} <<
   std::declval<T>() is valid, and if so, register a function which
   simply uses the operator.
b) In QVariant, we ask the metatype system for the contained types
   registered debug function and then use it.
If a type now does not have its own operator<< for QDebug, but is
implicitly convertible to QVariant containing itself, this would lead to
an infinite recursion, when trying to use qDebug with that type. The
registered function in a) would just convert the type to QVariant, and
then ask the QVariant to print itself.
Disallowing implicit conversions in qDebug in general was considered
(i.e. adding template<typename T> operator<<(T) = delete in QDebug ),
but discarded as it breaks too much code relying on conversions.

Fixes: QTBUG-87122
Change-Id: Ib709297670cbc6cc307efd0dfd8e5b0279df9414
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
2020-10-13 08:06:18 +02:00
..
cmake Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
concurrent Enable some-of the QtConcurrent test cases 2020-10-12 13:51:45 +02:00
corelib qDebug: Avoid implicit QVariant conversion 2020-10-13 08:06:18 +02:00
dbus Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
gui Fallback to using the family when doing an exact match 2020-10-12 14:08:06 +02:00
guiapplauncher Move QStateMachine from QtCore to QtScxml 2020-08-24 20:10:25 +02:00
installed_cmake
network tst_QTcpSocket::connectToHostError - increase the timeout 2020-10-08 22:09:44 +02:00
opengl Remove tst_QGL 2020-08-28 11:43:11 +02:00
other Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
printsupport Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
shared Remove most compiler warnings about missing overrides 2020-09-11 00:20:47 +02:00
sql Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
testlib Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
tools Another round of replacing 0 with nullptr 2020-10-07 23:02:47 +02:00
widgets Avoid repeated date-time formatting in test data naming 2020-10-09 01:09:24 +02:00
xml CMake: Regenerate projects to use new qt_internal_ API 2020-09-23 16:59:06 +02:00
.prev_CMakeLists.txt CMake: Regenerate projects 2020-09-22 19:08:53 +02:00
auto.pro Don't error out when configuring Qt on a headless system 2020-09-26 14:36:13 +02:00
CMakeLists.txt CMake: Fix building with -DQT_FEATURE_gui=OFF 2020-09-15 20:05:32 +02:00
network-settings.h Revert "QAbstractSocket: deprecate 'error' member-function" 2020-02-26 23:07:52 +03:00