From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 999043858C31; Sat, 18 Mar 2023 09:50:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 999043858C31 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1679133029; bh=Bgwty+F9osTPjiLTz3g4U7xStF8EmWu+5RAD4gzAEfM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=utVdVO/tsHu/rZFzw/SElSJYHOmdGwxKEIlzezQdk1Xeepl4yMRnO75o4UYMDG7ph rtqnPwbS2GsaKUaZNiWQqWHewsi1axEMRBnHS4hXwEZeu0eageo+CUYeiyXosb+pz5 FziZ7HISLiE2ZzDS2L0orGByQfvYipBoLtTxVhBQ= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109172] [10/11/12/13 Regression] g++ calls a private destructor with the keyword throw after the try-block Date: Sat, 18 Mar 2023 09:50:28 +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: 13.0 X-Bugzilla-Keywords: accepts-invalid X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jason at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109172 --- Comment #7 from Jonathan Wakely --- No. This line means the test has to exit with an error referring to that li= ne of the source, and it must contain the string "private": throw *new Demo; // { dg-error private } If it compiles without a matching error, the test fails. It doesn't matter whether it links successfully or not. In any case, the default action for compiler tests is to compile them, and = not try to link, so it would never give a linker error even if the expected compilation error is absent. https://gcc.gnu.org/onlinedocs/gccint/Directives.html documents the default action, which is { dg-do compile }. If the test contained { dg-do link } or { dg-do run } then there would be a linker error if the private destructor wasn't diagnosed, but that still wouldn't match the expected error on line 12.=