re PR c++/65858 (ICE in varpool_node::get_constructor during chromium build on arm...
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 1 May 2015 18:43:40 +0000 (18:43 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 1 May 2015 18:43:40 +0000 (18:43 +0000)
/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/Wnarrowing4.C: New.

Co-Authored-By: Prathamesh Kulharni <prathamesh.kulkarni@linaro.org>
From-SVN: r222699

gcc/cp/ChangeLog
gcc/cp/typeck2.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C [new file with mode: 0644]

index 14279fe91fc5419f61f0e269a91187fea461f996..65cb5bee27b6d47b8576700e17cb73f2e6b2e221 100644 (file)
@@ -1,3 +1,10 @@
+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.
+
 2015-04-30  David Malcolm  <dmalcolm@redhat.com>
 
        * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove spurious
index 884957bc9bbf19cc6df82dd63f75f0e8d7b66718..9a491aa71f23f351534b561fdbdc63ab48778ddb 100644 (file)
@@ -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;
        }
     }
index 2aedc46e74d52c35a801604bf04b0b61834586bc..e6ccf477a1e504285691cb216167fe63151abe42 100644 (file)
@@ -1,3 +1,9 @@
+2015-05-01  Paolo Carlini  <paolo.carlini@oracle.com>
+           Prathamesh Kulharni  <prathamesh.kulkarni@linaro.org>
+
+       PR c++/65858
+       * g++.dg/cpp0x/Wnarrowing4.C: New.
+
 2015-05-01  Rasmus Villemoes  <rv@rasmusvillemoes.dk>
 
        * gcc.dg/20150120-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C
new file mode 100644 (file)
index 0000000..d2dd383
--- /dev/null
@@ -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 };