https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94590

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpola...@gcc.gnu.org>:

https://gcc.gnu.org/g:5d5dcc65aae1024da31e0e9cae6a8966461037e8

commit r11-176-g5d5dcc65aae1024da31e0e9cae6a8966461037e8
Author: Marek Polacek <pola...@redhat.com>
Date:   Sun Apr 19 18:46:40 2020 -0400

    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.

Reply via email to