diff options
author | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-24 16:41:39 +0000 |
---|---|---|
committer | paolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-05-24 16:41:39 +0000 |
commit | 22d0902534ad849546a0d95be8ff88e19fad2af1 (patch) | |
tree | 4f9fbe543d45236309df3af03e28b466ef83a978 /gcc/cp/typeck2.c | |
parent | 6ef0143d8a1ce423db0ae0da55760b4fb82f3bdf (diff) |
/cp
2016-05-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/69872
* typeck2.c (check_narrowing): Check pedwarn return value.
/testsuite
2016-05-24 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/69872
* g++.dg/warn/Wno-narrowing1.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@236651 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r-- | gcc/cp/typeck2.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/cp/typeck2.c b/gcc/cp/typeck2.c index 833be20f7fe..835a44f1cf6 100644 --- a/gcc/cp/typeck2.c +++ b/gcc/cp/typeck2.c @@ -950,10 +950,12 @@ check_narrowing (tree type, tree init, tsubst_flags_t complain) { if (complain & tf_warning_or_error) { - if (!almost_ok || pedantic) - pedwarn (loc, OPT_Wnarrowing, "narrowing conversion of %qE " - "from %qT to %qT inside { }", init, ftype, type); - if (pedantic && almost_ok) + if ((!almost_ok || pedantic) + && pedwarn (loc, OPT_Wnarrowing, + "narrowing conversion of %qE " + "from %qT to %qT inside { }", + init, ftype, type) + && almost_ok) inform (loc, " the expression has a constant value but is not " "a C++ constant-expression"); ok = true; |