Summary: | accessiblevaluelabel.cpp fails to build with Clang 16 | ||
---|---|---|---|
Product: | [Applications] kleopatra | Reporter: | Raphael Kubo da Costa <rakuco> |
Component: | general | Assignee: | Ingo Klöcker <kloecker> |
Status: | RESOLVED UPSTREAM | ||
Severity: | normal | CC: | asturm, kdepim-bugs, kloecker, mutz, sam |
Priority: | NOR | ||
Version: | git master | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | All | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Raphael Kubo da Costa
2023-07-07 16:47:17 UTC
Actually this is unrelated to C++17, it's just Clang 16 being stricter and pointing out invalid code (even if I manually make it build that file in C++14 mode, for example). QAccessible::UserRole is documented as "The first value to be used for user defined roles.". Hence, we are supposed to use QAccessible::UserRole + n for user defined roles. I'm using QAccessible::UserRole + 1. Unfortunately, Qt chose 0x0000ffff as value for QAccessible::UserRole, so that all values of the QAccessible::Role enum fit into uint16 and apparently clang 16 chooses uint16 as underlying type (because the "underlying type is an implementation-defined integral type that can represent all enumerator values"). I consider this a bug in Qt. To me, Qt clearly intends QAccessible::Role as a 32-bit enum (apparent from the 32-bit hex notation used for the enum values) and therefore needs to state int (or unsigned int) explicitly as underlying type of QAccessible::Role: ``` enum Role { NoRole = 0x00000000, TitleBar = 0x00000001, MenuBar = 0x00000002, ``` https://code.qt.io/cgit/qt/qtbase.git/tree/src/gui/accessible/qaccessible_base.h This is related to bug https://bugreports.qt.io/browse/QTBUG-64962 which was closed as invalid without addressing the issue that compilers can choose smaller underlying types than (seemingly) intended by Qt. Who's going to revive that upstream bug then? It's on my todo list to open an upstream bug for this. The old bug was mainly about int vs. unsigned int. For now the fix is to patch enum Role { to enum Role : int { in src/gui/accessible/qaccessible_base.h of qtbase. Upstream bug report for Qt: https://bugreports.qt.io/browse/QTBUG-117517 |