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.