aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2021-07-15 18:45:49 -0400
committerMarek Polacek <polacek@redhat.com>2021-07-16 09:28:37 -0400
commite32234536f361796e7cad8ed69a1c0bb46ee55de (patch)
treec0ac3663d3c024c8c2cb55f07e8a476a557d32e0 /gcc/tree-vrp.c
parent650c70a9fe7198394d3bbe4c0b1a7a73dc0bdd4a (diff)
downloadgcc-e32234536f361796e7cad8ed69a1c0bb46ee55de.zip
gcc-e32234536f361796e7cad8ed69a1c0bb46ee55de.tar.gz
gcc-e32234536f361796e7cad8ed69a1c0bb46ee55de.tar.bz2
c++: Don't hide narrowing errors in system headers
Jonathan pointed me at this issue where constexpr unsigned f() { constexpr int n = -1; return unsigned{n}; } is accepted in system headers, despite the narrowing conversion from a constant. I suspect that whereas narrowing warnings should be disabled, ill-formed narrowing of constants should be a hard error (which can still be disabled by -Wno-narrowing). gcc/cp/ChangeLog: * typeck2.c (check_narrowing): Don't suppress the pedantic error in system headers. libstdc++-v3/ChangeLog: * testsuite/20_util/ratio/operations/ops_overflow_neg.cc: Add dg-error. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/Wnarrowing2.C: New test. * g++.dg/cpp1y/Wnarrowing2.h: New test.
Diffstat (limited to 'gcc/tree-vrp.c')
0 files changed, 0 insertions, 0 deletions