diff options
author | Paolo Carlini <paolo.carlini@oracle.com> | 2015-05-04 20:58:33 +0000 |
---|---|---|
committer | Paolo Carlini <paolo@gcc.gnu.org> | 2015-05-04 20:58:33 +0000 |
commit | f5322614a6fb5a0ce3cf85914e85946296271e91 (patch) | |
tree | 2e6c675a3efb74c7972b72a21781fdc4533e8487 /gcc/cp/typeck2.c | |
parent | 467d8d51f1304b955136060db0a34e1f80f098bb (diff) | |
download | gcc-f5322614a6fb5a0ce3cf85914e85946296271e91.zip gcc-f5322614a6fb5a0ce3cf85914e85946296271e91.tar.gz gcc-f5322614a6fb5a0ce3cf85914e85946296271e91.tar.bz2 |
re PR c++/66007 (Narrowing conversion inside { } results in all zero elements in C++11 mode with -Wno-error=narrowing)
/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.
Co-Authored-By: Jakub Jelinek <jakub@redhat.com>
From-SVN: r222778
Diffstat (limited to 'gcc/cp/typeck2.c')
-rw-r--r-- | gcc/cp/typeck2.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; } |