public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paolo Carlini <paolo.carlini@oracle.com>
To: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>,
	       gcc Patches <gcc-patches@gcc.gnu.org>,
	       Jason Merrill <jason@redhat.com>
Subject: Re: [C++ patch] PR 65858
Date: Thu, 30 Apr 2015 20:44:00 -0000	[thread overview]
Message-ID: <5542858A.7050703@oracle.com> (raw)
In-Reply-To: <55427865.8020601@oracle.com>

[-- Attachment #1: Type: text/plain, Size: 387 bytes --]

Hi again,

On 04/30/2015 08:45 PM, Paolo Carlini wrote:
> .. also, your patch doesn't seem to fix the case of -w instead of 
> -Wno-narrowing. I think we want to check the return value of the 
> pedwarn instead. I'm testing something.
I'm finishing testing the below: with hindsight, checking the return 
value of the pedwarn makes a lot of sense to me!

Paolo.

///////////////////////

[-- Attachment #2: patch_65858 --]
[-- Type: text/plain, Size: 1103 bytes --]

Index: cp/typeck2.c
===================================================================
--- cp/typeck2.c	(revision 222628)
+++ cp/typeck2.c	(working copy)
@@ -959,9 +959,10 @@ check_narrowing (tree type, tree init, tsubst_flag
       else if (complain & tf_error)
 	{
 	  global_dc->pedantic_errors = 1;
-	  pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing,
-		   "narrowing conversion of %qE from %qT to %qT inside { }",
-		   init, ftype, type);
+	  if (!pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing,
+			"narrowing conversion of %qE from %qT to %qT "
+			"inside { }", init, ftype, type))
+	    ok = true;
 	  global_dc->pedantic_errors = flag_pedantic_errors;
 	}
     }
Index: testsuite/g++.dg/cpp0x/Wnarrowing4.C
===================================================================
--- testsuite/g++.dg/cpp0x/Wnarrowing4.C	(revision 0)
+++ testsuite/g++.dg/cpp0x/Wnarrowing4.C	(working copy)
@@ -0,0 +1,6 @@
+// PR c++/65858
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target lto }
+// { dg-options "-flto -Wno-narrowing" }
+
+int x { 0.5 };

  reply	other threads:[~2015-04-30 19:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-30 17:21 Prathamesh Kulkarni
2015-04-30 18:01 ` Paolo Carlini
2015-04-30 19:08   ` Paolo Carlini
2015-04-30 20:44     ` Paolo Carlini [this message]
2015-04-30 21:15       ` Prathamesh Kulkarni
2015-05-01 17:25       ` Jason Merrill

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=5542858A.7050703@oracle.com \
    --to=paolo.carlini@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=prathamesh.kulkarni@linaro.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).