diff options
author | Marek Polacek <polacek@redhat.com> | 2020-04-19 18:46:40 -0400 |
---|---|---|
committer | Marek Polacek <polacek@redhat.com> | 2020-05-07 14:15:37 -0400 |
commit | 5d5dcc65aae1024da31e0e9cae6a8966461037e8 (patch) | |
tree | fb7af4ad2866a940fc07338d26f5e1ff224325d1 /libcpp/lex.c | |
parent | 21968d4ae067e3fa1c1728c8db26478e8ac8ad0b (diff) | |
download | gcc-5d5dcc65aae1024da31e0e9cae6a8966461037e8.zip gcc-5d5dcc65aae1024da31e0e9cae6a8966461037e8.tar.gz gcc-5d5dcc65aae1024da31e0e9cae6a8966461037e8.tar.bz2 |
c++: Detect long double -> double narrowing [PR94590]
This PR points out that we don't detect long double -> double narrowing
when long double happens to have the same precision as double; on x86_64
this can be achieved by -mlong-double-64.
[dcl.init.list]#7.2 specifically says "from long double to double or float,
or from double to float", but check_narrowing only checks
TYPE_PRECISION (type) < TYPE_PRECISION (ftype)
so we need to handle the other cases too, e.g. by same_type_p as in
the following patch.
PR c++/94590 - Detect long double -> double narrowing.
* typeck2.c (check_narrowing): Detect long double -> double
narrowing even when double and long double have the same
precision. Make it handle conversions to float too.
* g++.dg/cpp0x/Wnarrowing18.C: New test.
Diffstat (limited to 'libcpp/lex.c')
0 files changed, 0 insertions, 0 deletions