[Bug c++/81660] Add -Wexceptions warning
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 6 21:41:18 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81660
--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:
https://gcc.gnu.org/g:43d3b7bc073df27800218b685e6d7dd78dd31905
commit r11-4803-g43d3b7bc073df27800218b685e6d7dd78dd31905
Author: Marek Polacek <polacek@redhat.com>
Date: Thu Nov 5 21:46:06 2020 -0500
c++: Small tweak to can_convert_eh [PR81660]
While messing with check_handlers_1, I spotted this bug report which
complains that we don't warn about the case when we have two duplicated
handlers of type int. can_convert_eh implements [except.handle] and
that says: A handler is a match for an exception object of type E if
- The handler is of type cv T or cv T& and E and T are the same type
(ignoring the top-level cv-qualifiers), or [...]
but we don't implement this bullet properly for non-class types. The
fix therefore seems pretty obvious. Also change the return type to
bool when we're only returning yes/no.
gcc/cp/ChangeLog:
PR c++/81660
* except.c (can_convert_eh): Change the return type to bool. If
the type TO and FROM are the same, return true.
gcc/testsuite/ChangeLog:
PR c++/81660
* g++.dg/warn/Wexceptions3.C: New test.
* g++.dg/eh/pr42859.C: Add dg-warning.
* g++.dg/torture/pr81659.C: Likewise.
More information about the Gcc-bugs
mailing list