Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
QString::arg(): don't ignore signedness in (unscoped) enums
std::is_signed doesn't work on enums. Instead of SFINAE'ing out for non-arithmetic types, it returns false. This changes the output of (unscoped) enums with signed underlying_type from signed to unsigned, compared to Qt 6.8. To fix, use an enum's underlying_type to determine signedness. This is complicated by the fact that std::underlying_type SFINAE's out (since C++20) or even constitutes UB (until C++17) when called on non-enums, so we have to be careful to limit the use of it to just enums, which we reach by passing the meta-function (underlying_type), not its result (underlying_type_t) to std::conditional and then calling he result. This requires the non-enum branch to be a meta-function, too (and not just a type), which is easily achieved using q20::type_identity. Use ::type::type instead of mixing _t and ::type to not confuse users (the leading `typename` is required, anyway, because at least one trailing ::type is required, and typename std::conditional_t looks wrong). Amends 563ed82. Fixes: QTBUG-131906 Change-Id: I6d122d5a48bffb1e09eb0d7841bb8f1f79cd882f Reviewed-by: Ivan Solovev <[email protected]> Reviewed-by: Fabian Kosmale <[email protected]>
- Loading branch information