aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/gcc/gcc-5.1/backport/0003-PR66007.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/gcc/gcc-5.1/backport/0003-PR66007.patch')
-rw-r--r--meta/recipes-devtools/gcc/gcc-5.1/backport/0003-PR66007.patch73
1 files changed, 73 insertions, 0 deletions
diff --git a/meta/recipes-devtools/gcc/gcc-5.1/backport/0003-PR66007.patch b/meta/recipes-devtools/gcc/gcc-5.1/backport/0003-PR66007.patch
new file mode 100644
index 0000000000..7c1a19cd7f
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-5.1/backport/0003-PR66007.patch
@@ -0,0 +1,73 @@
+From 3b1253116b7cb98da33c997bffa5fa2616aee40a Mon Sep 17 00:00:00 2001
+From: paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
+Date: Mon, 4 May 2015 20:59:03 +0000
+Subject: [PATCH] /cp 2015-05-04 Paolo Carlini <paolo.carlini@oracle.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/66007
+ * typeck2.c (check_narrowing): Check by-hand that the pedwarn didn't
+ result in an actual error.
+
+/testsuite
+2015-05-04 Paolo Carlini <paolo.carlini@oracle.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/66007
+ * g++.dg/cpp0x/Wnarrowing4.C: New.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-5-branch@222779 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 | 8 +++++---
+ gcc/testsuite/ChangeLog | 6 ++++++
+ gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C | 14 ++++++++++++++
+ 4 files changed, 32 insertions(+), 3 deletions(-)
+ create mode 100644 gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C
+
+diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c
+index 9a491aa..c0df823 100644
+--- a/gcc/cp/typeck2.c
++++ b/gcc/cp/typeck2.c
+@@ -958,10 +958,12 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain)
+ }
+ else if (complain & tf_error)
+ {
++ int savederrorcount = errorcount;
+ global_dc->pedantic_errors = 1;
+- if (!pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing,
+- "narrowing conversion of %qE from %qT to %qT "
+- "inside { }", init, ftype, type))
++ pedwarn (EXPR_LOC_OR_LOC (init, input_location), OPT_Wnarrowing,
++ "narrowing conversion of %qE from %qT to %qT "
++ "inside { }", init, ftype, type);
++ if (errorcount == savederrorcount)
+ ok = true;
+ global_dc->pedantic_errors = flag_pedantic_errors;
+ }
+diff --git a/gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C
+new file mode 100644
+index 0000000..7defce3
+--- /dev/null
++++ b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C
+@@ -0,0 +1,14 @@
++// PR c++/66007
++// { dg-do run { target c++11 } }
++// { dg-options "-Wno-error=narrowing" }
++
++extern "C" void abort();
++
++int main()
++{
++ unsigned foo[] = { 1, -1, 3 };
++ if (foo[0] != 1 || foo[1] != __INT_MAX__ * 2U + 1 || foo[2] != 3)
++ abort();
++}
++
++// { dg-prune-output "narrowing conversion" }
+--
+2.1.4
+