qt6-bb10/tests/auto/corelib/text/qstring
Marc Mutz 738a84115f tst_QString: extend arg() tests with enums w/o explicit underlying_type
The QtDeclarative code causing QTBUG-131906 hits UB, because it tries
to store -666 in an enum {A, B}, which has a valid range of [0,1],
therefore its underlying_type is uint, yet, as per [conv.prom]/3¹,
integer-promotes to _int_ instead, so in Qt 6.8 would cause the
arg(int) overload to be called, outputting -666, while in Qt 6.9, it's
treated (correctly) as an unsigned value, outputting -666's two's
complement, a positive value.

Add a version of the scenario that does not cause UB.

¹ Thanks to Ahmad Samir for digging up the pertinent legalese.

Task-number: QTBUG-131906
Pick-to: 6.5
Change-Id: Iba1a04de523a0b4cd1c87deea40c643cf16df14f
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
(cherry picked from commit e64fd05fecae291c9d7358d2e47d7170995af256)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 06a209384aff389af1b73cc77266f9b392219845)
2024-12-13 08:00:16 +00:00
..
.gitignore Move text-related code out of corelib/tools/ to corelib/text/ 2019-07-10 17:05:30 +02:00
CMakeLists.txt QString: use comparison helper macros - trivial changes [1/3] 2024-03-02 00:12:53 +01:00
double_data.h Change license for tests files 2024-02-04 09:56:42 +01:00
tst_qstring.cpp tst_QString: extend arg() tests with enums w/o explicit underlying_type 2024-12-13 08:00:16 +00:00
tst_qstring_mac.mm Change license for tests files 2024-02-04 09:56:42 +01:00
tst_qstring_wasm.cpp Change license for tests files 2024-02-04 09:56:42 +01:00