qt5base-lts/tests/auto/corelib/kernel
Giuseppe D'Angelo bb0a616260 QObject: overhaul narrowing detection
Use P0608's trick to detect convertibility without narrowing;
and now that we can depend on C++17, use its features.

First, this moves the burden of detecting a narrowing conversion on
the compiler, rather than us maintaining a complicated series
of checks. Of course, this exposes

* bugs in compilers (e.g. GCC < 9 thinks that float->bool is not
  narrowing;

* behavior still not (widely) implemented (pointer to bool
  conversions are narrowing, P1957);

* interesting compiler choices, e.g. GCC 9 thinks that unscoped
  enumerations are non-narrowing convertible to a datatype big
  enum to contain all the _enumerators_, even if the underlying
  type of the enum (and/or its sizeof()) is wider than the target
  datatype.

Second, it allows to detect conversions that have a narrowing
conversion as an intermediate step. Given a type like

  struct Bad { operator double() const; };

then an object of type Bad is implictly convertible to a type
like int via a narrowing conversion. Therefore, a connection
is possible between a signal carrying a Bad and a slot accepting
an int. We can now detect and block this.

Tests regarding scoped enumerations have been dropped,
for the simple reason that a scoped enumeration is not
implictly convertible to an integral type, so we don't have
that detection (it would constantly fail). Scoped enumerations
do not take part in narrowing conversions anyhow, cf. [dcl.init.list].

[ChangeLog][QtCore][QObject] The detection of narrowing conversions
when calling QObject::connect() when
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT now takes also
into account user-defined implicit conversions that undergo
through a narrowing conversion.

Change-Id: Ie09d59203fe6283378b36dfbc54de1d58098ef51
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
2020-04-15 15:20:45 +02:00
..
qcoreapplication Port from QAtomic::load() to loadRelaxed() 2019-06-20 20:48:59 +02:00
qdeadlinetimer Merge remote-tracking branch 'origin/5.15' into dev 2020-03-04 14:39:18 +00:00
qelapsedtimer Merge remote-tracking branch 'origin/5.15' into dev 2020-03-16 18:41:27 +01:00
qeventdispatcher Detect double timer during single timeout in registerTimer test, and skip 2020-02-22 02:52:36 +01:00
qeventloop Regenerate projects one last time before merge 2020-02-12 17:30:49 +00:00
qmath Regenerate tests/auto/corelib/kernel 2019-11-12 17:25:04 +00:00
qmetaenum Regenerate tests/auto/corelib/kernel 2019-11-12 17:25:04 +00:00
qmetamethod Regenerate tests/auto/corelib/kernel 2019-11-12 17:25:04 +00:00
qmetaobject MetaObject: store the QMetaType of the properties 2020-02-25 15:43:15 +01:00
qmetaobjectbuilder Regenerate projects one last time before merge 2020-02-12 17:30:49 +00:00
qmetaproperty MetaObject: store the QMetaType of the properties 2020-02-25 15:43:15 +01:00
qmetatype Enable qmetatype test with CMake 2020-04-01 10:29:33 +02:00
qmimedata Regenerate tests/auto/corelib/kernel 2019-11-12 17:25:04 +00:00
qobject QObject: overhaul narrowing detection 2020-04-15 15:20:45 +02:00
qpointer Regenerate tests/auto/corelib/kernel 2019-11-12 17:25:04 +00:00
qproperty QProperty: Add support for member function change handlers 2020-04-06 14:25:12 +02:00
qsharedmemory Regenerate tests/auto/corelib/kernel 2019-11-12 17:25:04 +00:00
qsignalblocker Regenerate tests/auto/corelib/kernel 2019-11-12 17:25:04 +00:00
qsignalmapper Merge remote-tracking branch 'origin/5.15' into dev 2020-02-13 18:31:40 +01:00
qsocketnotifier Regenerate projects one last time before merge 2020-02-12 17:30:49 +00:00
qsystemsemaphore Regenerate tests/auto/corelib/kernel 2019-11-12 17:25:04 +00:00
qtimer Regenerate projects one last time before merge 2020-02-12 17:30:49 +00:00
qtranslator Merge remote-tracking branch 'origin/5.15' into dev 2020-02-13 18:31:40 +01:00
qvariant Merge remote-tracking branch 'origin/5.15' into dev 2020-04-08 20:11:39 +02:00
qwineventnotifier Regenerate projects one last time before merge 2020-02-12 17:30:49 +00:00
.prev_CMakeLists.txt cmake: Remove APPLE prefix from platform names 2020-03-16 17:57:56 +01:00
CMakeLists.txt Enable qmetatype test with CMake 2020-04-01 10:29:33 +02:00
kernel.pro Initial import of the Qt C++ property binding system 2020-03-16 18:19:45 +01:00