qt6-bb10/tests/auto/corelib
Marc Mutz 78073f8ab6 Restore C++20-deprecated mixed-enum bitwise operators
C++20 deprecated arithmetic on enum types. For enums used on QFlags<>,
these operators have always been user-defined, but when the two enums
are of different type, such as QFrame::Shape and QFrame::Shadow, the
deprecation warning pops up.

We have in the past fixed these in our headers by manual casts, but
that doesn't help our users when our API requires them to OR together
enums of different type.

Until we can rework these APIs to use a variadic QFlags type, we need
to fix it in an SC and BC way, which is what this patch sets out to
do.

The idea is simply to mark pairs of enums that are designed to be ORed
together and replace the deprecated built-in bitwise operators with
user-defined ones in C++20. To ensure SC and BC, we pass an explicit
result type and use that to check, in C++17 builds, that it matches
the decltype of the result of the built-in operator.

This patch is the first in a series of similar patches. It introduces
said markup macro and applies it to all enum pairs that create
warnings on (my) Linux GCC 11.3 and Clang 10.0.0 builds. It is
expected that more such markups are needed, for other modules, and for
symmetry.

Even with this patch, there is one mixed-enum warning left, in
qxcbwindow.cpp. This appears to be a genuine bug (cf. QTBUG-101306),
so this patch doesn't mark the enums involved in it as designed to be
used together.

This patch also unearthed that QT_TYPESAFE_FLAGS, possibly
unsurprisingly so, breaks several mixed bitwise flags-enum operations
(QTBUG-101344).

Pick-to: 6.3 6.2 5.15
Task-number: QTBUG-99948
Change-Id: I86ec11c1e4d31dfa81e2c3aad031b2aa113503eb
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
2022-03-15 11:36:09 +01:00
..
animation tst_qanimationgroup: fix memleaks 2022-01-05 08:22:00 +01:00
global Restore C++20-deprecated mixed-enum bitwise operators 2022-03-15 11:36:09 +01:00
io qDecodeDataUrl(): treat ";base64" marker as case-insensitive 2022-03-11 19:15:49 +00:00
itemmodels Fix test to pass with QT_FORCE_ASSERTS 2022-02-18 18:55:38 +01:00
kernel Blacklist: test cases blacklisted in tst_QSystemSemaphore: 2022-03-10 08:18:42 +00:00
mimetypes Remove unused .qrc files 2022-01-17 23:17:01 +01:00
platform Android: Add runOnMainAndroidThread() under QNativeInterface 2021-05-26 23:24:11 +00:00
plugin Fix test when accessing patched plugin too fast 2022-02-25 14:52:34 +02:00
serialization Revert "Blacklist: test cases blacklisted in tst_QXmlStream:" 2022-03-15 07:32:32 +00:00
text Add some %-encoding round-trip tests that use % in the plain-text 2022-03-14 20:16:34 +01:00
thread QMutexLocker: add isLocked() 2022-03-15 03:32:14 +01:00
time Add tests for an assertion seen on Windows 2022-03-04 23:26:13 +01:00
tools tst_qflatmap: fix -Wunused-local-typedef (Clang) 2022-03-11 19:15:49 +00:00
CMakeLists.txt Add tests for QAndroidApplication's sdkVersion and activity 2021-05-13 01:41:36 +03:00