aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-5.1/backport/0002-PR65858.patch
blob: e7a4fd792c1dc495dfc784aec5593c1b1dbc9dae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
From 82e461dc9d53927de7dae667880b63c2d497172d Mon Sep 17 00:00:00 2001
From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Fri, 1 May 2015 18:47:55 +0000
Subject: [PATCH] /cp 2015-05-01  Paolo Carlini  <paolo.carlini@oracle.com> 
     Prathamesh Kulharni  <prathamesh.kulkarni@linaro.org>

	PR c++/65858
	* typeck2.c (check_narrowing): Set ok = true when pedwarn returns
	false.

/testsuite
2015-05-01  Paolo Carlini  <paolo.carlini@oracle.com>
	    Prathamesh Kulharni  <prathamesh.kulkarni@linaro.org>

	PR c++/65858
	* g++.dg/cpp0x/Wnarrowing3.C: New.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@222700 138bc75d-0d04-0410-961f-82ee72b054a4
---
Upstream-Status: Backport
Signed-off-by: Khem Raj <raj.khem@gmail.com>

 gcc/cp/ChangeLog                         | 7 +++++++
 gcc/cp/typeck2.c                         | 7 ++++---
 gcc/testsuite/ChangeLog                  | 6 ++++++
 gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C | 6 ++++++
 4 files changed, 23 insertions(+), 3 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C

diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
index 884957b..9a491aa 100644
--- a/gcc/cp/typeck2.c
+++ b/gcc/cp/typeck2.c
@@ -959,9 +959,10 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain)
       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;
 	}
     }
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C
new file mode 100644
index 0000000..d2dd383
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing3.C
@@ -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 };
-- 
2.1.4