diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2020-12-28 02:06:41 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-01-18 14:53:24 +0000 |
commit | 5a0e5521e4455e98f963d65319e87eb53a644610 (patch) | |
tree | 5a4d972436236eb7bb74b77a180aaf5a7f3e08d1 /src/corelib/kernel/qobject_p.h | |
parent | f1465c621c11712991fabe5b8b81ccbb6eea4bb9 (diff) |
QVectorND: make some constructors explicit
QVector2D has implicit conversions towards QVector3D/4D, and
QVector3D has an implicit conversion towards QVector4D. Although
in principle this is fine because it's not a data loss, it's still
sketchy; for instance, it allows mixed operations to compile:
vector2d + vector3d;
vector4d - vector3d;
vector3d * vector4d; // !
(Random observation: the conversion from QPoint(F) to QVectorND are
actually already marked as explicit.)
This is a leftover not done for Qt 6.0. I am not making these opt-out:
having an implicit conversion here is outright *dangerous*, and any usage
that fails to compile needs to be inspected to make sure it was the
intended behavior.
[ChangeLog][Potentially Source-Incompatible Changes] The
QVector2D/3D/4D converting constructors from another QVectorND
now explicit. This was done to prevent a category of bugs resulting
from operations accidentally mixing QVectorND objects.
Fixes: QTBUG-90327
Change-Id: Ifcd873f6a0d3fc10b9e68c935fe1f69f86a2340b
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/corelib/kernel/qobject_p.h')
0 files changed, 0 insertions, 0 deletions