Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.5, 6.6
-
None
-
-
3
-
0d85d0a72 (dev), da580a12b (dev), 4cb06919a (6.8)
-
Foundations Sprint 94, Foundations Sprint 95, Foundations Sprint 96, Foundations Sprint 97
Description
qfloat16 explicitly implements all relational operators for comparing with various FP types (float, double, long double), but for integral types it provides only operators for comparison with int.
As a result, code like that will fail to compile:
qfloat16 f16 = 1.0; int i = 1; qint64 i64 = 1; qDebug() << (f16 == i); // fine, we have explicit operator==(qfloat16, int) qDebug() << (f16 == i64); // ERROR: ambiguity
This is discovered while working on C++20 comparison story, but this is a pre-existing problem.
So, should we provide comparison operator overloads for all integral types (signed and unsigned)?
Attachments
Issue Links
- relates to
-
QTBUG-104113 Modernize comparisons: can we provide macros?
-
- Closed
-
-
QTBUG-118193 qfloat16 compares all integral values outside its range equal to infinity
-
- Open
-
For Gerrit Dashboard: QTBUG-117637 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
514861,30 | qfloat16: extend comparison with integral types | dev | qt/qtbase | Status: MERGED | +2 | 0 |
581603,5 | qfloat16: remove IsIntegral work-around | dev | qt/qtbase | Status: MERGED | +2 | 0 |
583536,2 | qfloat16: remove IsIntegral work-around | 6.8 | qt/qtbase | Status: MERGED | +2 | 0 |