public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.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	[thread overview]
Message-ID: <bug-109172-4-4LCKJLHoXx@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-109172-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109172

--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> ---
No. This line means the test has to exit with an error referring to that line
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.

  parent reply	other threads:[~2023-03-18  9:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-17 11:39 [Bug c++/109172] New: " MikeSmith32564 at mail dot com
2023-03-17 11:50 ` [Bug c++/109172] " redi at gcc dot gnu.org
2023-03-17 11:57 ` [Bug c++/109172] [10/11/12/13 Regression] " redi at gcc dot gnu.org
2023-03-17 12:21 ` rguenth at gcc dot gnu.org
2023-03-17 15:05 ` jakub at gcc dot gnu.org
2023-03-17 19:28 ` jason at gcc dot gnu.org
2023-03-17 21:32 ` cvs-commit at gcc dot gnu.org
2023-03-17 21:36 ` jason at gcc dot gnu.org
2023-03-18  3:15 ` MikeSmith32564 at mail dot com
2023-03-18  9:50 ` redi at gcc dot gnu.org [this message]
2023-03-18  9:51 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-109172-4-4LCKJLHoXx@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).