public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/94590] Incorrectly accepts invalid C++11 braced initialisation of double from long double if sizeof(long double)==sizeof(double)
Date: Thu, 07 May 2020 18:16:47 +0000	[thread overview]
Message-ID: <bug-94590-4-fW9TVUHguL@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-94590-4@http.gcc.gnu.org/bugzilla/>

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 <mpolacek@gcc.gnu.org>:

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

commit r11-176-g5d5dcc65aae1024da31e0e9cae6a8966461037e8
Author: Marek Polacek <polacek@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.

  parent reply	other threads:[~2020-05-07 18:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-14  8:59 [Bug c++/94590] New: " dangelog at gmail dot com
2020-04-14 10:15 ` [Bug c++/94590] " redi at gcc dot gnu.org
2020-04-15  8:42 ` dangelog at gmail dot com
2020-04-19 17:05 ` mpolacek at gcc dot gnu.org
2020-04-19 17:32 ` mpolacek at gcc dot gnu.org
2020-04-20 19:40 ` mpolacek at gcc dot gnu.org
2020-05-07 18:16 ` cvs-commit at gcc dot gnu.org [this message]
2020-05-07 18:18 ` mpolacek at gcc dot gnu.org
2020-05-07 23:35 ` dangelog at gmail dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-94590-4-fW9TVUHguL@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).