From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9870A3844047; Fri, 6 Nov 2020 21:41:18 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9870A3844047 From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/81660] Add -Wexceptions warning Date: Fri, 06 Nov 2020 21:41:18 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 7.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: enhancement X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: mpolacek at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 06 Nov 2020 21:41:18 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D81660 --- Comment #4 from CVS Commits --- The master branch has been updated by Marek Polacek : https://gcc.gnu.org/g:43d3b7bc073df27800218b685e6d7dd78dd31905 commit r11-4803-g43d3b7bc073df27800218b685e6d7dd78dd31905 Author: Marek Polacek 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.=