From 38920aec4c036782cd362e27ae154dfa68b86428 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Fri, 1 May 2015 18:43:40 +0000 Subject: [PATCH] re PR c++/65858 (ICE in varpool_node::get_constructor during chromium build on arm-linux-gnueabihf with LTO during LINK chrome) /cp 2015-05-01 Paolo Carlini Prathamesh Kulharni PR c++/65858 * typeck2.c (check_narrowing): Set ok = true when pedwarn returns false. /testsuite 2015-05-01 Paolo Carlini Prathamesh Kulharni PR c++/65858 * g++.dg/cpp0x/Wnarrowing4.C: New. Co-Authored-By: Prathamesh Kulharni From-SVN: r222699 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/typeck2.c | 7 ++++--- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C | 6 ++++++ 4 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 14279fe91fc..65cb5bee27b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2015-05-01 Paolo Carlini + Prathamesh Kulharni + + PR c++/65858 + * typeck2.c (check_narrowing): Set ok = true when pedwarn returns + false. + 2015-04-30 David Malcolm * cp-tree.h (ARGUMENT_PACK_SELECT_ARG): Remove spurious diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 884957bc9bb..9a491aa71f2 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/ChangeLog b/gcc/testsuite/ChangeLog index 2aedc46e74d..e6ccf477a1e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-05-01 Paolo Carlini + Prathamesh Kulharni + + PR c++/65858 + * g++.dg/cpp0x/Wnarrowing4.C: New. + 2015-05-01 Rasmus Villemoes * 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 index 00000000000..d2dd3837dda --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/Wnarrowing4.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.30.2