diff options
| author | Marc Mutz <marc.mutz@qt.io> | 2024-09-12 16:38:12 +0200 |
|---|---|---|
| committer | Marc Mutz <marc.mutz@qt.io> | 2024-09-14 14:40:00 +0200 |
| commit | c38e58dcb02cd2273ba3c03c65a6f67b37100777 (patch) | |
| tree | 4e37822c3c2787523eb4d62d82a39522a92ce671 /src/widgets/dialogs/qinputdialog.cpp | |
| parent | 5820d54103d5c432ae8eaae180aefb1988f835ce (diff) | |
Fix -Wdouble-promotion in FP overload of convertDoubleTo()
Found by applying headercheck to private headers.
Says GCC:
global/qnumeric_p.h: In instantiation of ‘[...]
{anonymous}::convertDoubleTo(double, T*, bool) [with T = float;
[...]]’:
text/qlocale_p.h:312:51: required from here
global/qnumeric_p.h:390:22: error: implicit conversion from ‘float’
to ‘double’ to match other operand of binary expression
[-Werror=double-promotion]
390 | if (std::fabs(v) > (std::numeric_limits<T>::max)()) {
| ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Since we already checked that numeric_limits<T>::max_exponent <
numeric_limits<double>::max_exponent at this point (see constexpr-if
at the top of this function template), we can assume that the cast of
the RHS of the relational operator to double is safe. Use braced
initialization to statically assert that this is, indeed, the case.
Amends 1e43b64a7a5c3823a6bdcb8d0cd28a17955939a2 and
a14bba6803f674edede596eaeb5a46feed0f889e.
Pick-to: 6.8 6.7 6.5 6.2 5.15
Task-number: QTBUG-126219
Change-Id: If2b53d9b8ea7ebfcecec603408681eeffb9aaff6
Reviewed-by: Øystein Heskestad <oystein.heskestad@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/widgets/dialogs/qinputdialog.cpp')
0 files changed, 0 insertions, 0 deletions
